summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-11-24 16:14:58 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-11-24 16:14:58 -0500
commite2697d547ec8c24c9a37a72fc60abe73b7dee81b (patch)
tree7996ba7bb2879fc97f41526211a04a975952e4f0 /lib/sqlalchemy/orm/util.py
parent252bce8b02b1587a26b899c644ba28e78f5db4bc (diff)
downloadsqlalchemy-e2697d547ec8c24c9a37a72fc60abe73b7dee81b.tar.gz
Added a new exception to detect the case where two
subclasses are being loaded using with_polymorphic(), each subclass contains a relationship attribute of the same name, and eager loading is being applied to one or both. This is an ongoing bug which can't be immediately fixed, so since the results are usually wrong in any case it raises an exception for now. 0.7 has the same issue, so an exception raise here probably means the code was returning the wrong data in 0.7. [ticket:2614]
Diffstat (limited to 'lib/sqlalchemy/orm/util.py')
-rw-r--r--lib/sqlalchemy/orm/util.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py
index 97baffc9a..e5e725138 100644
--- a/lib/sqlalchemy/orm/util.py
+++ b/lib/sqlalchemy/orm/util.py
@@ -279,6 +279,12 @@ class PathRegistry(object):
def set(self, reg, key, value):
reg._attributes[(key, self.reduced_path)] = value
+ def replace(self, reg, key, value):
+ path_key = (key, self.reduced_path)
+ existing = reg._attributes.get(path_key, None)
+ reg._attributes[path_key] = value
+ return existing
+
def setdefault(self, reg, key, value):
reg._attributes.setdefault((key, self.reduced_path), value)