diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-06-14 22:44:59 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-06-14 22:44:59 -0400 |
| commit | 79d07c9abc7d4d3abb6bf2ca5ca66e87d3a11f08 (patch) | |
| tree | f893aeac44103cae9fb5e21e99c7954043a64bb4 /lib | |
| parent | de08740d7c21fa9dcef453bfd07a3defa428e88f (diff) | |
| download | sqlalchemy-79d07c9abc7d4d3abb6bf2ca5ca66e87d3a11f08.tar.gz | |
Consult is_attrbute flag to determine descriptor; enable for assoc proxy
Fixed bug where the :attr:`.Mapper.all_orm_descriptors` accessor would
return an entry for the :class:`.Mapper` itself under the declarative
``__mapper___`` key, when this is not a descriptor. The ``.is_attribute``
flag that's present on all :class:`.InspectionAttr` objects is now
consulted, which has also been modified to be ``True`` for an association
proxy, as it was erroneously set to False for this object.
Fixes: #4729
Change-Id: Ia02388cc25d004e32d337140b62a587f3e5a0b7b
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/ext/associationproxy.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/instrumentation.py | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py index 9a8294f3c..32dee79c6 100644 --- a/lib/sqlalchemy/ext/associationproxy.py +++ b/lib/sqlalchemy/ext/associationproxy.py @@ -93,7 +93,7 @@ ASSOCIATION_PROXY = util.symbol("ASSOCIATION_PROXY") class AssociationProxy(interfaces.InspectionAttrInfo): """A descriptor that presents a read/write view of an object attribute.""" - is_attribute = False + is_attribute = True extension_type = ASSOCIATION_PROXY def __init__( diff --git a/lib/sqlalchemy/orm/instrumentation.py b/lib/sqlalchemy/orm/instrumentation.py index 7cf46227f..ee0cc0600 100644 --- a/lib/sqlalchemy/orm/instrumentation.py +++ b/lib/sqlalchemy/orm/instrumentation.py @@ -143,7 +143,10 @@ class ClassManager(dict): for key in set(supercls.__dict__).difference(exclude): exclude.add(key) val = supercls.__dict__[key] - if isinstance(val, interfaces.InspectionAttr): + if ( + isinstance(val, interfaces.InspectionAttr) + and val.is_attribute + ): yield key, val def _get_class_attr_mro(self, key, default=None): |
