Re: toOne relationship returns base class instead of subcl
John Lenton <[email protected]> Wed, 25 Aug 2004 00:53:03 -0300
| Newsgroups | gmane.comp.python.modeling |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_41_14677377.1093405983162 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On 29 Jul 2004 10:30:02 +0200, Sebastien Bigaret <[email protected]> wrote: > > Again, could you be a little more explicit, or exhibit a short > example? Sorry for getting back on this, but the only way I think this > can happen is the one I already posted (see below); if it's not the > case, this is a serious bug I definitely do not want to let escape. sorry for the delay in answering, and the confusion when doing so. I feel terribly embarrassed :( HOWever, here goes. With the attached model (which is ugly, and breaks some of your naming conventions, but I just hacked out the attributes and renamed things from the model being used by a team I'm helping to get up to speed), using vainilla MDL 0.9-pre17.1 and NF 0.7: >>> from Modeling.EditingContext import EditingContext >>> import Store >>> ec=EditingContext() >>> ec.fetch('Address')[0] <Address.Address object at 0x4071c74c> >>> a = _ >>> p = ec.fetch('Person', isDeep=1)[0] <Employee.Employee object at 0x4072d88c> >>> p = _ >>> a.getPerson() <Employee.Employee object at 0x4072d88c> >>> a.getPerson().getId() 1 >>> a.isFault() False >>> p.getAddress() <Modeling.FaultHandler.AccessArrayFaultHandler instance at 0x40733a4c> >>> list(p.getAddress()) [<Address.Address object at 0x4071c74c>] >>> ec.fetch('Address', 'Person.id == 1') [] >>> ec.fetch('Address', 'Person.id == 1', isDeep=1) [] -- John Lenton ([email protected]) -- Random fortune: bash: fortune: command not found ------=_Part_41_14677377.1093405983162 Content-Type: text/x-python; name="model.py" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="model.py" from Modeling.PyModel import * # Defaults AString.defaults['width'] =3D 40 Entity.defaults['properties'] =3D [ APrimaryKey('id', isClassProperty=3D1, isRequired=3D1, doc=3D'PK') ] #Description Data sources dataSource =3D {'database': 'store', 'host': 'localhost', 'user': 'john', 'password': '', } model =3D Model('Store', adaptorName=3D'Postgresql', connDict =3D dataSource, version =3D '0.1', ) # entidades del modelo model.entities =3D [ Entity('Person'), Entity('Employee', parent =3D 'Person', properties =3D [AString('Tag'),], ), Entity('Address'), ] # asociaciones del modelo model.associations =3D[ Association('Address','Person', relations=3D['Person','Address'], delete=3D['nullify','deny'], ), ] ------=_Part_41_14677377.1093405983162-- ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285