diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-02-23 00:57:08 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-02-23 00:57:08 +0000 |
commit | bee34dfcd61106ee8eecebd7913efe1904ce5a4a (patch) | |
tree | 3632b19f6118e97a4cc43bc720842b06b57134cd /lib/sqlalchemy/ext/declarative.py | |
parent | c2060e8943e628404d9620ad60787c6af0a12b07 (diff) | |
download | sqlalchemy-bee34dfcd61106ee8eecebd7913efe1904ce5a4a.tar.gz |
- 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]
Diffstat (limited to 'lib/sqlalchemy/ext/declarative.py')
-rw-r--r-- | lib/sqlalchemy/ext/declarative.py | 7 |
1 files changed, 5 insertions, 2 deletions
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): |