no PK columns, would not detect that the joined table had no PK.
- fixed bugs in determining proper sync clauses from custom inherit
conditions [ticket:769]
+ - backref remove object operation doesn't fail if the other-side
+ collection doesn't contain the item, supports noload collections
+ [ticket:813]
+
- engine
- fixed another occasional race condition which could occur
when using pool with threadlocal setting
if oldchild is child:
return
if oldchild is not None:
- getattr(oldchild.__class__, self.key).remove(event, oldchild, obj)
+ try:
+ getattr(oldchild.__class__, self.key).remove(event, oldchild, obj)
+ except ValueError:
+ # supports 'noload' collections
+ pass
if child is not None:
getattr(child.__class__, self.key).append(event, child, obj)
ctx.current.delete(u)
ctx.current.flush()
-
+
def testdoublerelation(self):
m2 = mapper(Address, addresses)
m = mapper(User, users, properties={
u1 = ctx.current.query(User).get(u1.user_id)
u2 = ctx.current.query(User).get(u2.user_id)
assert a1.user is u2
+
+ def testbidirectional_noload(self):
+ mapper(User, users, properties={
+ 'addresses':relation(Address, backref='user', lazy=None)
+ })
+ mapper(Address, addresses)
+
+ sess = ctx.current
+
+ # try it on unsaved objects
+ u1 = User()
+ a1 = Address()
+ a1.user = u1
+ sess.save(u1)
+ sess.flush()
+ sess.clear()
+
+ a1 = sess.query(Address).get(a1.address_id)
+
+ a1.user = None
+ sess.flush()
+ sess.clear()
+ assert sess.query(Address).get(a1.address_id).user is None
+ assert sess.query(User).get(u1.user_id).addresses == []
+
class ManyToManyTest(UnitOfWorkTest):
def setUpAll(self):