summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative/api.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-04-09 14:21:40 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-04-09 14:21:40 -0400
commitd84ae4f75468fea6b3345c1275d6a472d0cf7c5f (patch)
tree69ae37b83fcbd196cb4cb9424c7f407ebf7acf21 /lib/sqlalchemy/ext/declarative/api.py
parent70a173d22b520b41acc8624f1a1d6c8c456412f7 (diff)
downloadsqlalchemy-d84ae4f75468fea6b3345c1275d6a472d0cf7c5f.tar.gz
Fixed indirect regression regarding :func:`.has_inherited_table`,
where since it considers the current class' ``__table__``, was sensitive to when it was called. This is 0.7's behavior also, but in 0.7 things tended to "work out" within events like ``__mapper_args__()``. :func:`.has_inherited_table` now only considers superclasses, so should return the same answer regarding the current class no matter when it's called (obviously assuming the state of the superclass). [ticket:2656]
Diffstat (limited to 'lib/sqlalchemy/ext/declarative/api.py')
-rw-r--r--lib/sqlalchemy/ext/declarative/api.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/declarative/api.py b/lib/sqlalchemy/ext/declarative/api.py
index af77919a7..6f3ffddc7 100644
--- a/lib/sqlalchemy/ext/declarative/api.py
+++ b/lib/sqlalchemy/ext/declarative/api.py
@@ -38,7 +38,7 @@ def has_inherited_table(cls):
"""Given a class, return True if any of the classes it inherits from has a
mapped table, otherwise return False.
"""
- for class_ in cls.__mro__:
+ for class_ in cls.__mro__[1:]:
if getattr(class_, '__table__', None) is not None:
return True
return False