RelatedJoin allows adding item several times

Daniel Fetchinson <[email protected]> Sun, 10 Nov 2013 22:21:21 +0100
Newsgroups gmane.comp.python.sqlobject
Message-ID <CADjSo4Q8qNoHVJdHAhuBwveFgefcPsQUH4j5NesTh2PJs_3Law@mail.gmail.com>
Perhaps it is by design but I was kind of surprised to see that if I have

class x(SQLObject):
    ys = RelatedJoin( 'y' )

class y(SQLObject):
    ....

then I'm allowed to add several times the same 'y' object to 'x' via

myx = x.get( 1 )
myy = y.get( 1 )
x.addY( myy )
x.addY( myy )
x.addY( myy )

Is there a keyword argument to RelatedJoin or to addY that forbids this?
Or I have to code this myself, i.e. check if an object is already
added, and if yes, refuse to do it?

Cheers,
Daniel



-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk