]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed previously untested function which regressed
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Sep 2011 20:23:15 +0000 (16:23 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Sep 2011 20:23:15 +0000 (16:23 -0400)
in 0.7, can now make a synonym() of a synonym()
again.

CHANGES
lib/sqlalchemy/orm/descriptor_props.py
test/orm/test_mapper.py

diff --git a/CHANGES b/CHANGES
index 99af9e4a3e3a9188a03a4a03be819ba671d64d0c..f98071715a1193a1d3f193c3e5d833a05ad1d438 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -15,6 +15,10 @@ CHANGES
      when the Session.is_active is True.
      [ticket:2241]
 
+  - Fixed previously untested function which regressed
+    in 0.7, can now make a synonym() of a synonym()
+    again.
+
   - Identity map .discard() uses dict.pop(,None) 
     internally instead of "del" to avoid KeyError/warning 
     during a non-determinate gc teardown [ticket:2267]
index f43952279a795b03464c94b72eebcd46b081d450..6385d40e2970e89c4bea2ef921a22f18ba8b94cf 100644 (file)
@@ -360,6 +360,8 @@ class SynonymProperty(DescriptorProperty):
 
         if self.comparator_factory:
             comp = self.comparator_factory(prop, mapper)
+        elif isinstance(prop, DescriptorProperty):
+            comp = prop._comparator_factory(mapper)
         else:
             comp = prop.comparator_factory(prop, mapper)
         return comp
index 90ad2d2158bc03eaa2a728cdad7a7e947ac889ec..306ca56a7789066867e55e670404903afc61ecfb 100644 (file)
@@ -1074,6 +1074,20 @@ class MapperTest(_fixtures.FixtureTest):
         eq_(User.uname.attribute, 123)
         eq_(User.uname['key'], 'value')
 
+    def test_synonym_of_synonym(self):
+        users,  User = (self.tables.users,
+                                self.classes.User)
+
+        mapper(User, users, properties={
+            'x':synonym('id'),
+            'y':synonym('x')
+        })
+
+        s = Session()
+        u = s.query(User).filter(User.y==8).one()
+        eq_(u.y, 8)
+
+
     def test_synonym_column_location(self):
         users, User = self.tables.users, self.classes.User