From: Mike Bayer Date: Wed, 23 Sep 2015 20:40:16 +0000 (-0400) Subject: - Fixed rare TypeError which could occur when stringifying certain X-Git-Tag: rel_1_1_0b1~84^2~70^2~101 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=47fcb1d0b6ad6481e89d4b2e8c2cc29cf7c03d8b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed rare TypeError which could occur when stringifying certain kinds of internal column loader options within internal logging. fixes #3539 --- diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index 61dec24bfc..09800bea81 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -18,6 +18,14 @@ .. 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 diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py index cb7a5fef74..3467328e3a 100644 --- a/lib/sqlalchemy/orm/strategy_options.py +++ b/lib/sqlalchemy/orm/strategy_options.py @@ -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: diff --git a/test/orm/test_options.py b/test/orm/test_options.py index 1c1a797a68..e1e26c62ce 100644 --- a/test/orm/test_options.py +++ b/test/orm/test_options.py @@ -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