Oleg Broytmann wrote:
> On Mon, Mar 10, 2008 at 02:16:46PM +0100, cedric briner wrote:
>> sqlobject=9.4
>>
>> class Person(SQLObject):
>>     sn = UnicodeCol()
>>     guarantor = ForeignKey('Person')
>>     #
>>     # guaranteds ; the opposed of guarantor like guest/host
>>     guaranteds = MultipleJoin('person')
>>
>> boss = Person(sn='The boss', guarantor=None)
>> l1   = Person(sn="labor 1", guarantor=boss)
>> l2   = Person(sn="labor 2", guarantor=boss)
>>
>> This work fine
>> l1.guarantor
>> #<Person 1L sn=u'The boss' guarantorID=None>
>>
>> # but this one not at all
>> boss.guaranteds
> 
>    There are two problems in
> 
>>     guaranteds = MultipleJoin('person')
> 
>    The problem number one: MultipleJoin('person') - 'person' must be the
> Python name of the class. In this case it is 'Person'.
> 
>    The problem number two is that MultipleJoin cannot find the
> corresponding ForeignKey because the names of the columns do not match.
> Just help the join by providing the db name of the key:
> 
>     guaranteds = MultipleJoin('Person', joinColumn="guarantor_id")
Yep, you're abosutely right. I'm disapointed, because even if I've 
double checked your documentation, I didn't catch this. Is there some 
places where we can find some more complex example that the one shown in 
the main documentation. I mean a little bit more complicated and with 
good comments. Because it's true, that learning something with examples 
helps a lot the understandinf :)

Many thanks for your help
> Oleg.

Ced.


-- 

Cedric BRINER
Geneva - Switzerland

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to