]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
hey this works. (don't need to re-calc fks collection)
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Jun 2011 06:24:06 +0000 (02:24 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Jun 2011 06:24:06 +0000 (02:24 -0400)
lib/sqlalchemy/orm/properties.py

index dc12c105db9257cac7b68d5964b354a88c9b79ee..43fb567f8b198ac12cc5d03344c606d6861bcdb7 100644 (file)
@@ -1155,17 +1155,19 @@ class RelationshipProperty(StrategizedProperty):
             else:
                 self.direction = MANYTOONE
         else:
-            foreign_keys = [f for (c, f) in self.synchronize_pairs]
             parentcols = util.column_set(self.parent.mapped_table.c)
             targetcols = util.column_set(self.mapper.mapped_table.c)
 
             # fk collection which suggests ONETOMANY.
 
-            onetomany_fk = targetcols.intersection(foreign_keys)
+            onetomany_fk = targetcols.intersection(
+                            self._calculated_foreign_keys)
 
             # fk collection which suggests MANYTOONE.
 
-            manytoone_fk = parentcols.intersection(foreign_keys)
+            manytoone_fk = parentcols.intersection(
+                            self._calculated_foreign_keys)
+
             if not onetomany_fk and not manytoone_fk:
                 raise sa_exc.ArgumentError("Can't determine relationshi"
                         "p direction for relationship '%s' - foreign "