From f574bcf98de0d30f0a28bf82aae84098157de0f4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 13 May 2013 16:13:15 -0400 Subject: Fixed a regression from 0.7 caused by this ticket, which made the check for recursion overflow in self-referential eager joining too loose, missing a particular circumstance where a subclass had lazy="joined" or "subquery" configured and the load was a "with_polymorphic" against the base. [ticket:2481] --- lib/sqlalchemy/orm/util.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 35cb0bdf5..390e83538 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -304,7 +304,14 @@ class PathRegistry(object): yield path[i], path[i + 1] def contains_mapper(self, mapper): - return mapper in self.path + for path_mapper in [ + self.path[i] for i in range(0, len(self.path), 2) + ]: + if isinstance(path_mapper, mapperlib.Mapper) and \ + path_mapper.isa(mapper): + return True + else: + return False def contains(self, reg, key): return (key, self.path) in reg._attributes -- cgit v1.2.1