]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed rare TypeError which could occur when stringifying certain
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 23 Sep 2015 20:40:16 +0000 (16:40 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 23 Sep 2015 20:40:16 +0000 (16:40 -0400)
kinds of internal column loader options within internal logging.
fixes #3539

doc/build/changelog/changelog_10.rst
lib/sqlalchemy/orm/strategy_options.py
test/orm/test_options.py

index 61dec24bfceabafbdf068e7334b3f99e753c4373..09800bea812e544e785a73d33c9ba42e791ed73a 100644 (file)
 .. changelog::
     :version: 1.0.9
 
+    .. change::
+        :tags: bug, orm
+        :versions: 1.1.0b1
+        :tickets: 3539
+
+        Fixed rare TypeError which could occur when stringifying certain
+        kinds of internal column loader options within internal logging.
+
     .. change::
         :tags: bug, orm
         :versions: 1.1.0b1
index cb7a5fef74ed7c2f0e23f654fcc88c1bbf18b66c..3467328e3a1405058fdc847c08db67de7a7cabe1 100644 (file)
@@ -180,7 +180,7 @@ class Load(Generative, MapperOption):
         return path
 
     def __str__(self):
-        return "Load(strategy=%r)" % self.strategy
+        return "Load(strategy=%r)" % (self.strategy, )
 
     def _coerce_strat(self, strategy):
         if strategy is not None:
index 1c1a797a680bc93e8b6fb499fb58d5ca2c268763..e1e26c62ce4db4e8e25fe4a3c0de561c3708339e 100644 (file)
@@ -2,7 +2,7 @@ from sqlalchemy import inspect
 from sqlalchemy.orm import attributes, mapper, relationship, backref, \
     configure_mappers, create_session, synonym, Session, class_mapper, \
     aliased, column_property, joinedload_all, joinedload, Query,\
-    util as orm_util, Load
+    util as orm_util, Load, defer
 import sqlalchemy as sa
 from sqlalchemy import testing
 from sqlalchemy.testing.assertions import eq_, assert_raises, assert_raises_message
@@ -46,8 +46,18 @@ class PathTest(object):
             set([self._make_path(p) for p in paths])
         )
 
+
 class LoadTest(PathTest, QueryTest):
 
+    def test_str(self):
+        User = self.classes.User
+        l = Load(User)
+        l.strategy = (('deferred', False), ('instrument', True))
+        eq_(
+            str(l),
+            "Load(strategy=(('deferred', False), ('instrument', True)))"
+        )
+
     def test_gen_path_attr_entity(self):
         User = self.classes.User
         Address = self.classes.Address