Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BaseCampos(object):
- def __init__(self,Fname,prop):
- self.dato=""
- self.Fname=Fname
- self.Ftype=prop['Ftype']
- self.Fprop=prop['Fprop']
- print "Inicio de la clase BaseCampos"
- print self.Fname, self.Ftype, self.Fprop
- def __del__(self):
- print "Fin de la clase BaseCampos"
- def setDato(self, dato):
- self.dato = dato
- def getDato(self):
- return self.dato
- def getType(self):
- return self.Ftype
- class BaseTabla(object):
- def __init__(self):
- for attr_name in self.campos.keys():
- setattr(self, attr_name,
- BaseCampos(attr_name, self.campos[attr_name]))
- class Contactos(BaseTabla):
- campos = {'nombre':{'Ftype':'INT()',
- 'Fprop':'Not Null'}}
- c = Contactos()
- c.nombre.setDato('prueba de dato para el campo curso')
- print id(c.nombre)
- print c.nombre.getDato()
- print c.nombre.getType()
- del(c)
Advertisement
Add Comment
Please, Sign In to add comment