[Sqlalchemy-tickets] Issue #3185: More than one level of abstract concrete base classes does not wo
Brought to you by:
zzzeek
|
From: Alex G. <iss...@bi...> - 2014-09-05 12:32:58
|
New issue 3185: More than one level of abstract concrete base classes does not work https://bitbucket.org/zzzeek/sqlalchemy/issue/3185/more-than-one-level-of-abstract-concrete Alex Grönholm: The following code fails with AttributeError: 'NoneType' object has no attribute 'concrete': ``` #!python from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import AbstractConcreteBase, declarative_base Base = declarative_base() class Document(Base, AbstractConcreteBase): doctype = Column(Unicode, nullable=False) class ContactDocument(Document): __abstract__ = True send_method = Column('sendmethod', Unicode) class ActualDocument(ContactDocument): __tablename__ = 'actual_documents' __mapper_args__ = {'concrete': True, 'polymorphic_identity': 'actual'} id = Column(Integer, primary_key=True) configure_mappers() ``` This is caused by the __declare_first__() in AbstractConcreteBase not checking if the target subclass has a mapper or not. Attached is the patch I was given to remedy the issue. |