summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/path_registry.py
diff options
context:
space:
mode:
authorSławek Ehlert <slafs@op.pl>2015-01-27 22:04:38 +0100
committerSławek Ehlert <slafs@op.pl>2015-01-27 22:04:38 +0100
commit57b2bd5dcba6140b511c898c0f682234f13d5c51 (patch)
treea0899b2a35d27e177001b163054c3c9a8f7f1c06 /lib/sqlalchemy/orm/path_registry.py
parent6a1f16d09958e549502a0991890d64964c71b357 (diff)
parent8aaa8dd6bdfb85fa481efa3115b9080d935d344c (diff)
downloadsqlalchemy-pr/152.tar.gz
Merge branch 'master' into oracle-servicename-optionpr/152
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()