[Sqlalchemy-tickets] Issue #3383: Mapper setup does not run __declare_first__ or __declare_last__ i
Brought to you by:
zzzeek
|
From: Thorsten L. <iss...@bi...> - 2015-04-24 05:34:19
|
New issue 3383: Mapper setup does not run __declare_first__ or __declare_last__ in mixins anymore https://bitbucket.org/zzzeek/sqlalchemy/issue/3383/mapper-setup-does-not-run Thorsten Lockert: Handling of `__declare_first__` and `__declare_last__` (as used in e.g. the [PyCon 2014 ATM sample](https://bitbucket.org/zzzeek/pycon2014_atmcraft)) got broken with commit 7f82c55. One potential fix is the fragment below, but I am not convinced this is correct: ```patch --- ext/declarative/base.py 2015-04-23 20:27:08.000000000 -0700 +++ ext/declarative/base.py 2015-04-23 22:27:52.000000000 -0700 @@ -66,11 +66,10 @@ for base in cls.__mro__: _is_declarative_inherits = hasattr(base, '_decl_class_registry') - if attrname in base.__dict__: + if attrname in base.__dict__ and ( + base is cls or not _is_declarative_inherits): value = getattr(base, attrname) - if (base is cls or - (base in cls.__bases__ and not _is_declarative_inherits)): - return value + return value else: return None ``` Responsible: zzzeek |