]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Search through mapper superclass hierarchy for owner
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 9 Feb 2018 21:12:31 +0000 (16:12 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 9 Feb 2018 21:31:24 +0000 (16:31 -0500)
commitcc6cef5184df8d85ab220a061bdcf31fc636f28d
tree0451af6484e2576af274672c59194ea6491f0122
parentd41ab3d108c9cfd61c681ca179963f31ac295c09
Search through mapper superclass hierarchy for owner

Fixed regression caused by fix for issue :ticket:`4116` affecting versions
1.2.2 as well as 1.1.15, which had the effect of mis-calculation of the
"owning class" of an :class:`.AssociationProxy` as the ``NoneType`` class
in some declarative mixin/inheritance situations as well as if the
association proxy were accessed off of an un-mapped class.  The "figure out
the owner" logic has been replaced by an in-depth routine that searches
through the complete mapper hierarchy assigned to the class or subclass to
determine the correct (we hope) match; will not assign the owner if no
match is found.  An exception is now raised if the proxy is used
against an un-mapped instance.

Change-Id: I611b590df2babe077ce6c19bea89e84251d1a7f4
Fixes: #4185
(cherry picked from commit 650b9eddae0eb198c8f8dc2d1e1e3c6ac53b18f3)
doc/build/changelog/unreleased_11/4185.rst [new file with mode: 0644]
lib/sqlalchemy/ext/associationproxy.py
lib/sqlalchemy/orm/instrumentation.py
test/ext/test_associationproxy.py