mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-02 22:10:15 -04:00
- Fixed previously untested function which regressed
in 0.7, can now make a synonym() of a synonym() again.
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user