summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/path_registry.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm/path_registry.py')
-rw-r--r--lib/sqlalchemy/orm/path_registry.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/path_registry.py b/lib/sqlalchemy/orm/path_registry.py
index d4dbf29a0..ec80c70cc 100644
--- a/lib/sqlalchemy/orm/path_registry.py
+++ b/lib/sqlalchemy/orm/path_registry.py
@@ -52,6 +52,9 @@ class PathRegistry(object):
"""
+ is_token = False
+ is_root = False
+
def __eq__(self, other):
return other is not None and \
self.path == other.path
@@ -153,6 +156,8 @@ class RootRegistry(PathRegistry):
"""
path = ()
has_entity = False
+ is_aliased_class = False
+ is_root = True
def __getitem__(self, entity):
return entity._path_registry
@@ -168,6 +173,15 @@ class TokenRegistry(PathRegistry):
has_entity = False
+ is_token = True
+
+ def generate_for_superclasses(self):
+ if not self.parent.is_aliased_class and not self.parent.is_root:
+ for ent in self.parent.mapper.iterate_to_root():
+ yield TokenRegistry(self.parent.parent[ent], self.token)
+ else:
+ yield self
+
def __getitem__(self, entity):
raise NotImplementedError()