diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2019-05-31 00:50:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-05-31 00:50:20 +0000 |
commit | b27abee6f02132e255efde44ed23dd83036f5cc5 (patch) | |
tree | be2a163e010fce179d8dad51b0673e11e9a2833f /lib/sqlalchemy/orm/attributes.py | |
parent | df99e1ef5f334ce7f4c8118c3e0bdf2949f54de3 (diff) | |
parent | 5ac10699e1111283ae848f9d3a6dcc4e09d8c1ef (diff) | |
download | sqlalchemy-b27abee6f02132e255efde44ed23dd83036f5cc5.tar.gz |
Merge "Rework AliasedClass __getattr__ to use top-level getattr()"
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 31c351bb0..e277f6f5b 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -346,10 +346,14 @@ def create_proxied_attribute(descriptor): ) def __get__(self, instance, owner): - if instance is None: + retval = self.descriptor.__get__(instance, owner) + # detect if this is a plain Python @property, which just returns + # itself for class level access. If so, then return us. + # Otherwise, return the object returned by the descriptor. + if retval is self.descriptor and instance is None: return self else: - return self.descriptor.__get__(instance, owner) + return retval def __str__(self): return "%s.%s" % (self.class_.__name__, self.key) |