]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Don't barf on Session(info=...) from sessionmaker(info=None)
authorRobin Schoonover <robin@cornhooves.org>
Wed, 1 Jan 2014 01:37:13 +0000 (18:37 -0700)
committerRobin Schoonover <robin@cornhooves.org>
Wed, 1 Jan 2014 01:46:31 +0000 (18:46 -0700)
lib/sqlalchemy/orm/session.py
test/orm/test_session.py

index 0c3bc5cbe4fedc5f7811a0243ef528c6ffd50c8a..d6fc5baea1d1939781f197088ded075ba3d21aea 100644 (file)
@@ -2291,7 +2291,8 @@ class sessionmaker(_SessionClassMethods):
         kw['autoflush'] = autoflush
         kw['autocommit'] = autocommit
         kw['expire_on_commit'] = expire_on_commit
-        kw['info'] = info
+        if info is not None:
+            kw['info'] = info
         self.kw = kw
         # make our own subclass of the given class, so that
         # events can be associated with it specifically.
index 34b0c7effa0262771c93f4e49e6a07a065490b71..4eb498ee901cab18b35f2145d0a5db2de11f850a 100644 (file)
@@ -412,6 +412,10 @@ class SessionStateTest(_fixtures.FixtureTest):
         s3 = maker()
         eq_(s3.info, {"global": True, "s1": 5})
 
+        maker2 = sessionmaker()
+        s4 = maker2(info={'s4': 8})
+        eq_(s4.info, {'s4': 8})
+
     @testing.requires.independent_connections
     @engines.close_open_connections
     def test_autoflush(self):