raise exceptions.InvalidRequestError("This session is unbound to any Engine or Connection; specify a mapper to get_bind()")
elif self.__binds.has_key(mapper):
return self.__binds[mapper]
- elif self.__binds.has_key(mapper.mapped_table):
+ elif self.__binds.has_key(mapper.compile().mapped_table):
return self.__binds[mapper.mapped_table]
elif self.bind is not None:
return self.bind
f1.element = b1
b2.element = f2
- assert manager.get_history(f1, 'element').hasparent(b1)
- assert not manager.get_history(f1, 'element').hasparent(b2)
- assert not manager.get_history(f1, 'element').hasparent(f2)
- assert manager.get_history(b2, 'element').hasparent(f2)
+ assert getattr(Foo, 'element').hasparent(b1)
+ assert not getattr(Foo, 'element').hasparent(b2)
+ assert not getattr(Foo, 'element').hasparent(f2)
+ assert getattr(Bar, 'element').hasparent(f2)
b2.element = None
- assert not manager.get_history(b2, 'element').hasparent(f2)
+ assert not getattr(Bar, 'element').hasparent(f2)
def testmutablescalars(self):
"""test detection of changes on mutable scalar items"""
self.assert_(u.user_name == 'jack')
self.assert_(a not in u.addresses)
-
+ def testcompileonsession(self):
+ m = mapper(User, users)
+ session = create_session()
+ session.connection(m)
+
def testexpirecascade(self):
mapper(User, users, properties={'addresses':relation(mapper(Address, addresses), cascade="all, refresh-expire")})
s = create_session()