synonyms don't handle PropComparator; make more powerful synonym() function
Issue #801
resolved
the use case for synonym should be set up with something less verbose and which actually supports instrumentation: i.e.
class Foo(object):
def _get_bar(self):
return self._bar
def _set_bar(self, value):
self._bar = value
mapper(Foo, bar, properties={
'someprop' : synonym('_bar', column=bar.c.somecol, getter=Foo._get_bar, setter=Foo._set_bar)
})
use two InstrumentedAttributes here, and have the 'someprop' InstrumentedAttribute replace its getter/setter with the custom ones sent in. have mapper._compile_property() pull out a separate ColumnProperty from the SynonymProperty (i.e. we use two MapperProperties here too).
Comments (3)
-
-
reporter - changed status to resolved
that works just great. committed in 4ee70702230244569913da0de64f988ff0de06b8.
-
reporter - removed milestone
Removing milestone: 0.4.xx (automated comment)
- Log in to comment
rather than getter=, etc., how about simply wrapping a user's 'property' instance with instrumentation. a synonym wrapper can reuse the impl guts from the base property.