From: Mike Bayer Date: Tue, 21 Mar 2006 20:15:44 +0000 (+0000) Subject: fixed lazy clause construction to go off...you guessed it...the noninherited table ! X-Git-Tag: rel_0_1_5~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc856c44126481c5b523c3102986fbed2fa924a7;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixed lazy clause construction to go off...you guessed it...the noninherited table ! --- diff --git a/lib/sqlalchemy/mapping/properties.py b/lib/sqlalchemy/mapping/properties.py index ff3d1548c1..192ba3fc57 100644 --- a/lib/sqlalchemy/mapping/properties.py +++ b/lib/sqlalchemy/mapping/properties.py @@ -563,7 +563,7 @@ class PropertyLoader(MapperProperty): class LazyLoader(PropertyLoader): def do_init_subclass(self, key, parent): - (self.lazywhere, self.lazybinds) = create_lazy_clause(self.parent.table, self.primaryjoin, self.secondaryjoin, self.foreignkey) + (self.lazywhere, self.lazybinds) = create_lazy_clause(self.parent.noninherited_table, self.primaryjoin, self.secondaryjoin, self.foreignkey) # determine if our "lazywhere" clause is the same as the mapper's # get() clause. then we can just use mapper.get() self.use_get = not self.uselist and self.mapper._get_clause.compare(self.lazywhere) @@ -645,6 +645,7 @@ def create_lazy_clause(table, primaryjoin, secondaryjoin, foreignkey): lazywhere = lazywhere.copy_container() li = BinaryVisitor(visit_binary) lazywhere.accept_visitor(li) + print "OK LAZYWHERE, START WITH TAB", table, "PJ", primaryjoin, "SEC", secondaryjoin, "GOT", lazywhere return (lazywhere, binds)