diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-23 12:40:26 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-23 12:47:08 -0400 |
| commit | 626356842d77d4ec6427b3bfc04bdff93d24d246 (patch) | |
| tree | 2f9fbf98d73f3647f814940b9d2116d022052ee8 /lib/sqlalchemy/orm | |
| parent | 469931514a1517dde82ba56f780c3007c66d5943 (diff) | |
| download | sqlalchemy-626356842d77d4ec6427b3bfc04bdff93d24d246.tar.gz | |
Unwrap Proxy objects when scanning declared_attr
Fixed bug where the declarative scan for attributes would receive the
expression proxy delivered by a hybrid attribute at the class level, and
not the hybrid attribute itself, when receiving the descriptor via the
``@declared_attr`` callable on a subclass of an already-mapped class. This
would lead to an attribute that did not report itself as a hybrid when
viewed within :attr:`.Mapper.all_orm_descriptors`.
Fixes: #4326
Change-Id: I582d03f05c3768b3344f93e3791240e9e69b9d1e
Diffstat (limited to 'lib/sqlalchemy/orm')
| -rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/base.py | 7 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/descriptor_props.py | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 0bbe70655..745032e44 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -271,6 +271,8 @@ def create_proxied_attribute(descriptor): self._adapt_to_entity = adapt_to_entity self.__doc__ = doc + _is_internal_proxy = True + @property def property(self): return self.comparator.property diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index 8c9d56269..e06e1fc78 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -475,6 +475,13 @@ class InspectionAttr(object): """ + _is_internal_proxy = False + """True if this object is an internal proxy object. + + .. versionadded:: 1.2.12 + + """ + is_clause_element = False """True if this object is an instance of :class:`.ClauseElement`.""" diff --git a/lib/sqlalchemy/orm/descriptor_props.py b/lib/sqlalchemy/orm/descriptor_props.py index a8db3fe1c..aaf53b698 100644 --- a/lib/sqlalchemy/orm/descriptor_props.py +++ b/lib/sqlalchemy/orm/descriptor_props.py @@ -500,6 +500,7 @@ class ConcreteInheritedProperty(DescriptorProperty): (self.parent, self.key, self.parent)) class NoninheritedConcreteProp(object): + def __set__(s, obj, value): warn() |
