[Modeling-users] possible bug with autorelationships
Status: Abandoned
Brought to you by:
sbigaret
From: Lorenzo G. S. <lg...@si...> - 2004-09-17 12:19:52
|
Hi, I have a Person entity and I'm trying to define a relationship between two persons. Something like the husband/wife relationship. So far it works, the problem is when other classes appear in the inheritance tree. I have a Customer entity which is-a Person, which is-a BaseType. This is how my PyModel looks like: from Modeling.PyModel import * Entity.defaults['properties'] = [ APrimaryKey('id', isClassProperty=0, isRequired=1, doc='PK') ] _connDict = {'database': 'pruebas_modeling.sqlite'} model = Model('Pruebas', adaptorName='SQLite', connDict=_connDict, version='0.1') model.entities = [ Entity('BaseType', properties=[AFloat('oid', doc='Internal object identifier')] ), Entity('Person', properties=[AString('name'), AString('surname'), ADateTime('birthdate'), AInteger('employed', defaultValue=1), RToOne('husband', destination='Person', inverse='wife'), RToOne('wife', destination='Person', inverse='husband')], parent='BaseType', ), Entity('Customer', properties=[AFloat('salary')], parent='Person', ), ] model.build() ------------------------------------------------------ If I run that code I get this exception: Traceback (most recent call last): File "prueba_autorrelacion.py", line 32, in ? model.build() File "/opt/lib/python2.3/site-packages/Modeling/PyModel.py", line 228, in build entity.build_toOne_relationships(self) File "/opt/lib/python2.3/site-packages/Modeling/PyModel.py", line 446, in build_toOne_relationships prop.build(model, self) File "/opt/lib/python2.3/site-packages/Modeling/PyModel.py", line 701, in build entity.forward_rel_info(self, model) File "/opt/lib/python2.3/site-packages/Modeling/PyModel.py", line 437, in forward_rel_info rel.dst,invr.src=check_or_make_equal(rel.dst,invr.src) File "/opt/lib/python2.3/site-packages/Modeling/PyModel.py", line 421, in check_or_make_equal assert x == y AssertionError There are several ways to get rid of the exception: - Remove the Customer entity - Make the Person entity don't inherit from BaseType - Remove the BaseType entity Obviously none of those is what I want so I wonder if anyone in the list knows why my relations are messing the inheritance or viceversa. Thanks Lorenzo Gil Sanchez |