zzzeek/sqlalchemy — pull request #92 by smurfix (2014-05-19 01:15:30+00:00)
Title: Add a _proxyImpl helper class

If you can come up with a better test for this, that'd be even nicer.
(Formalchemy sure does some other somewhat-ugly things under the hood …)

formalchemy does the following:

if isinstance(self._impl, ScalarAttributeImpl) or self._impl.__class__.__name__ == '_ProxyImpl': # ProxyImpl is a one-off class for each synonym, can't import it
# normal property, mapped to a single column from the main table
prop = getattr(self._property, '_proxied_property', None)
if prop is None:
prop = self._property
return tuple(prop.local_columns)

With this patch, this test can be replaced with

if isinstance(self._impl, (ScalarAttributeImpl,ProxyImpl):
…