From: Mike Bayer Date: Thu, 30 Jun 2011 14:43:53 +0000 (-0400) Subject: - Fixed bug in the mutable extension whereby X-Git-Tag: rel_0_7_2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=287e9d6a77ef20da98c28901fd118f4401aaab41;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed bug in the mutable extension whereby if the same type were used twice in one mapping, the attributes beyond the first would not get instrumented. --- diff --git a/CHANGES b/CHANGES index a4d4e8356b..f220fb6d6b 100644 --- a/CHANGES +++ b/CHANGES @@ -77,6 +77,12 @@ CHANGES cx_oracle _Error.code to get at the code, [ticket:2200]. Also in 0.6.9. +-ext + - Fixed bug in the mutable extension whereby + if the same type were used twice in one + mapping, the attributes beyond the first + would not get instrumented. + - examples - Repaired the examples/versioning test runner to not rely upon SQLAlchemy test libs, diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index 39204f59d5..b31710ca8b 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -461,7 +461,6 @@ class Mutable(MutableBase): if hasattr(prop, 'columns'): if isinstance(prop.columns[0].type, sqltype): cls.associate_with_attribute(getattr(class_, prop.key)) - break event.listen(mapper, 'mapper_configured', listen_for_type) @@ -503,7 +502,6 @@ class Mutable(MutableBase): if hasattr(prop, 'columns'): if prop.columns[0].type is sqltype: cls.associate_with_attribute(getattr(class_, prop.key)) - break event.listen(mapper, 'mapper_configured', listen_for_type) diff --git a/test/ext/test_mutable.py b/test/ext/test_mutable.py index dec955bab0..9d0a4a0c89 100644 --- a/test/ext/test_mutable.py +++ b/test/ext/test_mutable.py @@ -132,9 +132,11 @@ class MutableWithScalarPickleTest(_MutableDictTestBase, fixtures.MappedTest): def define_tables(cls, metadata): MutationDict = cls._type_fixture() + mutable_pickle = MutationDict.as_mutable(PickleType) Table('foo', metadata, Column('id', Integer, primary_key=True, test_needs_autoincrement=True), - Column('data', MutationDict.as_mutable(PickleType)), + Column('skip', mutable_pickle), + Column('data', mutable_pickle), Column('non_mutable_data', PickleType) ) @@ -227,6 +229,7 @@ class MutableAssociationScalarPickleTest(_MutableDictTestBase, fixtures.MappedTe Table('foo', metadata, Column('id', Integer, primary_key=True, test_needs_autoincrement=True), + Column('skip', PickleType), Column('data', PickleType) )