From 5ca662f7bc172daa51e7776d496eeea886761981 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 26 Sep 2011 17:43:53 -0400 Subject: warn when a subclass' base uses @declared_attr for a regular column - does not propagate to subclasses. [ticket:2283] --- lib/sqlalchemy/ext/declarative.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/sqlalchemy/ext/declarative.py') diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index b58685414..efaf8f8db 100755 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -1030,6 +1030,12 @@ def _as_declarative(cls, classname, dict_): if base is not cls: inherited_table_args = True elif class_mapped: + if isinstance(obj, declarative_props): + util.warn("Regular (i.e. not __special__) " + "attribute '%s.%s' uses @declared_attr, " + "but owning class %s is mapped - " + "not applying to subclass %s." + % (base.__name__, name, base, cls)) continue elif base is not cls: # we're a mixin. -- cgit v1.2.1