Re: toOne relationship returns base class instead of subcl
John Lenton <[email protected]> Fri, 23 Jul 2004 10:46:14 -0300
| Newsgroups | gmane.comp.python.modeling |
|---|---|
| Message-ID | <[email protected]> |
On 23 Jul 2004 15:02:00 +0200, Sebastien Bigaret <[email protected]> wrote: > > John Lenton <[email protected]> wrote: > > in the model > > > > Person > > / \ > > | > > PhysicalPerson <---->> Address > > > > querying an Address for its PhysicalPerson returns Person instances, > > which was unexpected (for me, at least). Is this correct, or is it a > > bug? > > If you mean that, having an address 'addr', addr.getPerson() has class > 'Person', yes, this is intended, as long as addr.getPerson().isFault() > is True. As soon as you'll need an addr's person property the fault will > be fired and you'll get the correct class for addr.getPerson(). actually, what's biting me is this (I'm translating from a different model into this one that is similar to the example, for clarity and brevity; I hope I don't muss ep): >>> [i.getPerson().getId() for i in ec.fetch('Address')] [4, 5] >>> ec.fetch('Address', 'person.id == 4') [] in trying to simplify this last time I got the behaviour above, which I misinterpreted as the same thing. > Now you may wonder why this is like this. We discussed this here: > https://sourceforge.net/mailarchive/forum.php?thread_id=3457563&forum_id=10674 ok. Will read up---tomorrow (deadlines...!) -- John Lenton ([email protected]) -- Random fortune: bash: fortune: command not found ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click