]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
-fixed [ticket:555]
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 29 Jul 2007 01:16:01 +0000 (01:16 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 29 Jul 2007 01:16:01 +0000 (01:16 +0000)
- fixed attribute glitch breaking the build

lib/sqlalchemy/orm/session.py
test/orm/attributes.py
test/orm/mapper.py

index 6b5c4a0725ee29d953a0213bd5b5656bda27fa85..68c538034c59a5aa732a29ee5622860d69305e6e 100644 (file)
@@ -310,7 +310,7 @@ class Session(object):
                 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
index 9b5f738bf7f2fa7bfe8722ec8e8bc0814dcaed5d..8ca2d1b8e1a8ce1abfb9b3bb5227668ff9623df3 100644 (file)
@@ -322,13 +322,13 @@ class AttributesTest(PersistTest):
         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"""
index b72a10516abb9693be3220176a1bd801d379671a..12670c654cbf344db00e3ad91a334239a3ddca64 100644 (file)
@@ -87,7 +87,11 @@ class MapperTest(MapperSuperTest):
         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()