Hi
While trying to use an object created by a SQLObject subclass I'm
getting an exception like:
AttributeError: 'Product' object has no attribute '_SO_autoInitDone'
Since I'm new to SQLObject and I have some ugly hacks in my classes like:
class Product(SQLObject, Model):
_table =3D 'Produtos'
_idName =3D 'produto_id'
_columns =3D [
Col('code', dbName=3D'codigo'), # product code
Col('famID', dbName=3D'fam_id', foreignKey=3D'Family'),
Col('subID', dbName=3D'sub_id'),
Col('description', dbName=3D'descricao'),
Col('alt_description', dbName=3D'descricao_alt'),
Col('unit', dbName=3D'unidade'),
]
def __init__(self, *args):
Model.__init__(self)
# Im doing this here because product subfamily is an
# atribute which has a multiple key (famID and subID) and (I
# think) SQLObject doesn't support it.
self.sub =3D SubFamily.select(
AND(
SubFamily.q.famID =3D=3D self.famID,
SubFamily.q.subID =3D=3D self.subID))[0=
]
SQLObject.__init__(self, *args)
Im wondering if I'm not doing things that could be done different
(better) with support from SQLObject.
many thanks,
Bruno Trevisan
bt...@as... |=3D| Async Open Source |=3D| D. Alexandrina, 253=
4
http://www.async.com.br/ |=3D| +55 16 261-2331 |=3D| 13566-290
|=3D| +55 16 9781-8717 |=3D| S=E3o Carlos, SP, B=
rasil
|