From bee34dfcd61106ee8eecebd7913efe1904ce5a4a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 23 Feb 2010 00:57:08 +0000 Subject: - a change to the previous __mapper_args__ commit. - the __mapper_args__ dict is copied when propagating to a subclass, and is taken straight off the class __dict__ to avoid any propagation from the parent. mapper inheritance already propagates the things you want from the parent mapper. [ticket:1393] --- lib/sqlalchemy/ext/declarative.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/ext') diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index cc972fc6f..43177e2e2 100644 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -499,8 +499,11 @@ def _as_declarative(cls, classname, dict_): if not table.c.contains_column(c): raise exceptions.ArgumentError( "Can't add additional column %r when specifying __table__" % key) - - mapper_args = dict(getattr(cls, '__mapper_args__', {})) + + if '__mapper_args__' in dict_: + mapper_args = dict(dict_['__mapper_args__']) + else: + mapper_args = {} if 'inherits' not in mapper_args: for c in cls.__bases__: if _is_mapped_class(c): -- cgit v1.2.1