]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
2.5 compat
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 23 Jun 2012 19:37:18 +0000 (15:37 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 23 Jun 2012 19:37:18 +0000 (15:37 -0400)
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/session.py
test/ext/test_serializer.py

index 3234d2238025385ad559801ef656563b3e8b6580..8fb13b3a024f236a9537ddd10543bc96e8077abb 100644 (file)
@@ -80,7 +80,9 @@ def instances(query, cursor, context):
                     context.refresh_state.dict, query._only_load_props)
             context.progress.pop(context.refresh_state)
 
-        session._finalize_loaded(context.progress)
+        for state, dict_ in context.progress.items():
+            state.commit_all(dict_, session.identity_map)
+
 
         for ii, (dict_, attrs) in context.partials.iteritems():
             ii.commit(dict_, attrs)
index 2076f23d52fc22661671d9e27cc5cc9aef385fd9..1f302923d18df6bb25cd1ac05b5636f5f935163f 100644 (file)
@@ -1012,10 +1012,6 @@ class Session(object):
         if self.autoflush and not self._flushing:
             self.flush()
 
-    def _finalize_loaded(self, states):
-        for state, dict_ in states.items():
-            state.commit_all(dict_, self.identity_map)
-
     def refresh(self, instance, attribute_names=None, lockmode=None):
         """Expire and refresh the attributes on the given instance.
 
index 63a3cbe915afa861fe3ca9c4dd5631b899ec817a..0496479aa0e4f2f2550ab0c25bfbbbcb82b8ecd1 100644 (file)
@@ -78,6 +78,7 @@ class SerializeTest(fixtures.MappedTest):
         assert serializer.loads(serializer.dumps(User.name, -1), None,
                                 None) is User.name
 
+    @testing.requires.python26  # crashes in 2.5
     def test_expression(self):
         expr = \
             select([users]).select_from(users.join(addresses)).limit(5)
@@ -88,6 +89,7 @@ class SerializeTest(fixtures.MappedTest):
         eq_(re_expr.execute().fetchall(), [(7, u'jack'), (8, u'ed'),
             (8, u'ed'), (8, u'ed'), (9, u'fred')])
 
+    @testing.requires.python26  # namedtuple workaround not serializable in 2.5
     @testing.skip_if(lambda: util.pypy, "pickle sometimes has "
                         "problems here, sometimes not")
     def test_query(self):
@@ -126,6 +128,7 @@ class SerializeTest(fixtures.MappedTest):
         #eq_(q2.all(), [User(name='fred')])
         #eq_(list(q2.values(User.id, User.name)), [(9, u'fred')])
 
+    @testing.requires.python26 # namedtuple workaround not serializable in 2.5
     @testing.exclude('sqlite', '<=', (3, 5, 9),
                      'id comparison failing on the buildbot')
     def test_aliases(self):