]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Don't hard-evaluate non-ORM @declared_attr for AbstractConcreteBase
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 26 May 2017 17:26:40 +0000 (13:26 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 26 May 2017 17:28:15 +0000 (13:28 -0400)
commit8b82369347641d1c9d64406462fa5527132c4880
treea031040645ba90b6232545f3376419872a8eb00b
parentb1369b47217558779a5b8a17ecd945cedd608dc7
Don't hard-evaluate non-ORM @declared_attr for AbstractConcreteBase

Fixed bug where using :class:`.declared_attr` on an
:class:`.AbstractConcreteBase` where a particular return value were some
non-mapped symbol, including ``None``, would cause the attribute
to hard-evaluate just once and store the value to the object
dictionary, not allowing it to invoke for subclasses.   This behavior
is normal when :class:`.declared_attr` is on a mapped class, and
does not occur on a mixin or abstract class.  Since
:class:`.AbstractConcreteBase` is both "abstract" and actually
"mapped", a special exception case is made here so that the
"abstract" behavior takes precedence for :class:`.declared_attr`.

Change-Id: I6160ebb3a52c441d6a4b663c8c9bbac6d37fa417
Fixes: #3848
doc/build/changelog/changelog_12.rst
lib/sqlalchemy/ext/declarative/base.py
test/ext/declarative/test_mixin.py