- Fixed previously untested function which regressed

in 0.7, can now make a synonym() of a synonym()
again.
This commit is contained in:
Mike Bayer
2011-09-15 16:23:15 -04:00
parent 1cf80dc5b2
commit 4e5cd5fb0f
3 changed files with 20 additions and 0 deletions
+4
View File
@@ -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]
+2
View 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
+14
View 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