From: Mike Bayer Date: Mon, 13 Mar 2006 02:39:52 +0000 (+0000) Subject: tweak to get_direction, rolls back a comparison of "foreigntable" to "parent"/"mapper... X-Git-Tag: rel_0_1_4~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ab782cb0e1f0f0a6b4a68b67ce1aad03bee6f38;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git tweak to get_direction, rolls back a comparison of "foreigntable" to "parent"/"mapper" table to be more constrained. this change was originally in [changeset:1101] to help out the polymorph example but it now works without it. the change breaks the Post/Comment relationship in the ZBlog demo since the Post mapper has the comments table inside of it (also with no workaround). --- diff --git a/lib/sqlalchemy/mapping/properties.py b/lib/sqlalchemy/mapping/properties.py index fc6762b596..34b0ae48e4 100644 --- a/lib/sqlalchemy/mapping/properties.py +++ b/lib/sqlalchemy/mapping/properties.py @@ -228,9 +228,11 @@ class PropertyLoader(MapperProperty): return PropertyLoader.ONETOMANY elif self.secondaryjoin is not None: return PropertyLoader.MANYTOMANY - elif self.foreigntable is self.target or self.foreigntable in self.mapper.tables: + elif self.foreigntable == self.target: + #elif self.foreigntable is self.target or self.foreigntable in self.mapper.tables: return PropertyLoader.ONETOMANY - elif self.foreigntable is self.parent.table or self.foreigntable in self.parent.tables: + elif self.foreigntable == self.parent.table: + #elif self.foreigntable is self.parent.table or self.foreigntable in self.parent.tables: return PropertyLoader.MANYTOONE else: raise ArgumentError("Cant determine relation direction")