From 8daa6ccfb0be6486d36ebdd3cd709e8ebfbfa207 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 30 May 2014 15:36:13 -0400 Subject: - The ``__mapper_args__`` dictionary is copied from a declarative mixin or abstract class when accessed, so that modifications made to this dictionary by declarative itself won't conflict with that of other mappings. The dictionary is modified regarding the ``version_id_col`` and ``polymorphic_on`` arguments, replacing the column within with the one that is officially mapped to the local class/table. fixes #3062 --- lib/sqlalchemy/ext/declarative/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/ext') diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py index eb66f12b6..0e68faa03 100644 --- a/lib/sqlalchemy/ext/declarative/base.py +++ b/lib/sqlalchemy/ext/declarative/base.py @@ -73,7 +73,10 @@ def _as_declarative(cls, classname, dict_): # don't even invoke __mapper_args__ until # after we've determined everything about the # mapped table. - mapper_args_fn = lambda: cls.__mapper_args__ + # make a copy of it so a class-level dictionary + # is not overwritten when we update column-based + # arguments. + mapper_args_fn = lambda: dict(cls.__mapper_args__) elif name == '__tablename__': if not tablename and ( not class_mapped or -- cgit v1.2.1