]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Rework AliasedClass __getattr__ to use top-level getattr()
authorDmytro Starosud <d.starosud@gmail.com>
Wed, 29 May 2019 13:47:13 +0000 (16:47 +0300)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 29 May 2019 21:07:35 +0000 (17:07 -0400)
commit5ac10699e1111283ae848f9d3a6dcc4e09d8c1ef
tree2cee514317fc01465e4a61ff5ea51392a2727197
parent142c94348ad4a341f7cbff3d76bf0df397fa782f
Rework AliasedClass __getattr__ to use top-level getattr()

Reworked the attribute mechanics used by :class:`.AliasedClass` to no
longer rely upon calling ``__getattribute__`` on the MRO of the wrapped
class, and to instead resolve the attribute normally on the wrapped class
using getattr(), and then unwrap/adapt that.  This allows a greater range
of attribute styles on the mapped class including special ``__getattr__()``
schemes; but it also makes the code simpler and more resilient in general.

Fixes: #4694
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I28901e2472d3c21e881fe5cafa3b1d3af704fad8
doc/build/changelog/unreleased_13/4694.rst [new file with mode: 0644]
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/util.py
test/orm/test_utils.py