diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-09-23 16:40:16 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-09-23 16:40:16 -0400 |
commit | 47fcb1d0b6ad6481e89d4b2e8c2cc29cf7c03d8b (patch) | |
tree | 2c7c90f92f1e5bf675edf265f2d90947007ff555 | |
parent | 3dfcb10befc7a8c193ee992bdea009e39b2e798c (diff) | |
download | sqlalchemy-47fcb1d0b6ad6481e89d4b2e8c2cc29cf7c03d8b.tar.gz |
- Fixed rare TypeError which could occur when stringifying certain
kinds of internal column loader options within internal logging.
fixes #3539
-rw-r--r-- | doc/build/changelog/changelog_10.rst | 8 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/strategy_options.py | 2 | ||||
-rw-r--r-- | test/orm/test_options.py | 12 |
3 files changed, 20 insertions, 2 deletions
diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index 61dec24bf..09800bea8 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -21,6 +21,14 @@ .. 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 :tickets: 3525 Fixed bug in :meth:`.Session.bulk_save_objects` where a mapped diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py index cb7a5fef7..3467328e3 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 1c1a797a6..e1e26c62c 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 |