summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative.py
diff options
context:
space:
mode:
authorChris Withers <chris@simplistix.co.uk>2010-10-06 12:04:25 +0100
committerChris Withers <chris@simplistix.co.uk>2010-10-06 12:04:25 +0100
commita376f3e2daec1950b42822e94a8357848beaa18a (patch)
treee12c1ab2823e73c549a5a226932a928a66a892a2 /lib/sqlalchemy/ext/declarative.py
parent526d73ecfc6714f10b6df5f0d47d6fd1e41cd444 (diff)
downloadsqlalchemy-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-xlib/sqlalchemy/ext/declarative.py7
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()