diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/ext/associationproxy.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py index 72200c5e2..1ebc7b420 100644 --- a/lib/sqlalchemy/ext/associationproxy.py +++ b/lib/sqlalchemy/ext/associationproxy.py @@ -271,7 +271,12 @@ class AssociationProxy(interfaces.InspectionAttrInfo): # note we can get our real .key here too owner = insp.mapper.class_manager._locate_owning_manager(self) - self.owning_class = owner.class_ + if owner is not None: + self.owning_class = owner.class_ + else: + # the proxy is attached to a class that is not mapped + # (like a mixin), we are mapped, so, it's us. + self.owning_class = target_cls def __get__(self, obj, class_): if self.owning_class is None: |
