[Sqlalchemy-tickets] Issue #3626: @validates is not called on inherited subclasses (zzzeek/sqlalche
Brought to you by:
zzzeek
From: diego p. <iss...@bi...> - 2016-01-14 02:02:06
|
New issue 3626: @validates is not called on inherited subclasses https://bitbucket.org/zzzeek/sqlalchemy/issues/3626/validates-is-not-called-on-inherited diego pego: I think this is related to but do not duplicates #2943 ``` #!python from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class A(Base): __tablename__ = 'a' id = Column(Integer, primary_key=True) data = Column(String) reg_type = Column(String) @validates('data') def validate(self, key, value): return "yup A " + value __mapper_args__ = { 'polymorphic_identity':'a', 'polymorphic_on':reg_type } class B(A): __tablename__ = 'b' other_data = Column(String) @validates('other_data ') def validate_other_data(self, key, value): # >>>>> this is never called assert value.strip() != '' return value __mapper_args__ = { 'polymorphic_identity':'TYPE_B', } ``` |