Re: [Modeling-users] toOne relationship returns base class instead of subcl
Status: Abandoned
Brought to you by:
sbigaret
From: John L. <jl...@gm...> - 2004-07-23 13:46:17
|
On 23 Jul 2004 15:02:00 +0200, Sebastien Bigaret <sbi...@us...> wrote: > > John Lenton <jl...@gm...> 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 (jl...@gm...) -- Random fortune: bash: fortune: command not found |