Refactor table setting

This commit is contained in:
Konsta Vesterinen
2015-03-17 12:28:41 +02:00
parent 5f2b120bc7
commit 007c3c98b8

View File

@@ -70,10 +70,10 @@ def get_class_by_table(base, table, data=None):
:param data: Data row to determine the class in polymorphic scenarios :param data: Data row to determine the class in polymorphic scenarios
:return: Declarative class or None. :return: Declarative class or None.
""" """
found_classes = set() found_classes = set(
for c in base._decl_class_registry.values(): c for c in base._decl_class_registry.values()
if hasattr(c, '__table__') and c.__table__ is table: if hasattr(c, '__table__') and c.__table__ is table
found_classes.add(c) )
if len(found_classes) > 1: if len(found_classes) > 1:
if not data: if not data:
raise ValueError( raise ValueError(