]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed bug in the mutable extension whereby
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 30 Jun 2011 14:43:53 +0000 (10:43 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 30 Jun 2011 14:43:53 +0000 (10:43 -0400)
    if the same type were used twice in one
    mapping, the attributes beyond the first
    would not get instrumented.

CHANGES
lib/sqlalchemy/ext/mutable.py
test/ext/test_mutable.py

diff --git a/CHANGES b/CHANGES
index a4d4e8356b0a7ec6462e3242b2ae9df5757adad5..f220fb6d6bbb731e0379a66a691b9c754786dfbe 100644 (file)
--- 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,
index 39204f59d57efe48856ac00940e1520b04b3fdfa..b31710ca8b80325036d9790ce3f154bf9dc5404b 100644 (file)
@@ -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)
 
index dec955bab07df074c54e66be8ab01b92ee41d545..9d0a4a0c89cdf21506a396396d6a681da0132846 100644 (file)
@@ -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)
         )