From: Mike Bayer Date: Mon, 14 Apr 2008 15:54:23 +0000 (+0000) Subject: added info about _local_remote_pairs to error message X-Git-Tag: rel_0_5beta1~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a98ffb0598bdf68ff649c9d75fc75ab0c1c1fc0;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git added info about _local_remote_pairs to error message --- diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index 0eece6466f..140fffd892 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -566,8 +566,12 @@ class PropertyLoader(StrategizedProperty): "For more relaxed rules on join conditions, the relation may be marked as viewonly=True." % (self.primaryjoin, self) ) else: - raise exceptions.ArgumentError("Could not determine relation direction for primaryjoin condition '%s', on relation %s. " - "Specify the foreign_keys argument to indicate which columns on the relation are foreign." % (self.primaryjoin, self)) + if arg_foreign_keys: + raise exceptions.ArgumentError("Could not determine relation direction for primaryjoin condition '%s', on relation %s. " + "Specify _local_remote_pairs=[(local, remote), (local, remote), ...] to explicitly establish the local/remote column pairs." % (self.primaryjoin, self)) + else: + raise exceptions.ArgumentError("Could not determine relation direction for primaryjoin condition '%s', on relation %s. " + "Specify the foreign_keys argument to indicate which columns on the relation are foreign." % (self.primaryjoin, self)) self.foreign_keys = util.OrderedSet([r for l, r in eq_pairs]) self._opposite_side = util.OrderedSet([l for l, r in eq_pairs])