diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-28 13:33:05 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-28 13:33:05 -0500 |
| commit | 4480eea62225951263892831190012dcea10c2e0 (patch) | |
| tree | f1583596ac50fef98cb54841c42bf2dd70b0ffd2 /lib/sqlalchemy/orm/interfaces.py | |
| parent | 378e86124b598f2773cf124beab853ad63b71ee9 (diff) | |
| download | sqlalchemy-4480eea62225951263892831190012dcea10c2e0.tar.gz | |
- [bug] Raise an exception if xyzload_all() is
used inappropriately with two non-connected
relationships. [ticket:2370]
Diffstat (limited to 'lib/sqlalchemy/orm/interfaces.py')
| -rw-r--r-- | lib/sqlalchemy/orm/interfaces.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index 7f2875e5a..bda48cbb1 100644 --- a/lib/sqlalchemy/orm/interfaces.py +++ b/lib/sqlalchemy/orm/interfaces.py @@ -568,7 +568,12 @@ class PropertyOption(MapperOption): "mapper option expects " "string key or list of attributes") assert prop is not None + if raiseerr and not prop.parent.common_parent(mapper): + raise sa_exc.ArgumentError("Attribute '%s' does not " + "link from element '%s'" % (token, path_element)) + path = build_path(path_element, prop.key, path) + l.append(path) if getattr(token, '_of_type', None): path_element = mapper = token._of_type @@ -580,8 +585,6 @@ class PropertyOption(MapperOption): "refer to a mapped entity" % (token, entity) ) - if path_element: - path_element = path_element if current_path: # ran out of tokens before |
