diff options
author | Chris Withers <chris@simplistix.co.uk> | 2010-10-06 12:04:25 +0100 |
---|---|---|
committer | Chris Withers <chris@simplistix.co.uk> | 2010-10-06 12:04:25 +0100 |
commit | a376f3e2daec1950b42822e94a8357848beaa18a (patch) | |
tree | e12c1ab2823e73c549a5a226932a928a66a892a2 /lib/sqlalchemy/ext/declarative.py | |
parent | 526d73ecfc6714f10b6df5f0d47d6fd1e41cd444 (diff) | |
download | sqlalchemy-a376f3e2daec1950b42822e94a8357848beaa18a.tar.gz |
warn when two classes with the same name end up in the declarative registry
Diffstat (limited to 'lib/sqlalchemy/ext/declarative.py')
-rwxr-xr-x | lib/sqlalchemy/ext/declarative.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index 586067527..57dff857c 100755 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -1046,6 +1046,13 @@ def _as_declarative(cls, classname, dict_): for k, v in mapper_args.iteritems(): mapper_args[k] = column_copies.get(v,v) + + if classname in cls._decl_class_registry: + util.warn("The classname %r is already in the registry of this" + " declarative base, mapped to %r" % ( + classname, + cls._decl_class_registry[classname] + )) cls._decl_class_registry[classname] = cls our_stuff = util.OrderedDict() |