[SQLObject] RelatedJoin allows adding item several times
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Daniel F. <fet...@go...> - 2013-11-10 21:21:28
|
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 |