diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-03-23 22:05:22 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-03-24 12:35:53 -0400 |
commit | da04aa577b6e539a6472df62ee39c4a51cca9dd9 (patch) | |
tree | 7746c455c102e15397b11c565b302a5b81f19c51 /lib/sqlalchemy/orm/util.py | |
parent | 8acbc2624fb4b457e47fab93e6a44a1e37caeddc (diff) | |
download | sqlalchemy-da04aa577b6e539a6472df62ee39c4a51cca9dd9.tar.gz |
Fix boolean check in new path comparison logic
Fixed regression where a new error message that was supposed to raise when
attempting to link a relationship option to an AliasedClass without using
:meth:`.PropComparator.of_type` would instead raise an ``AttributeError``.
Note that in 1.3, it is no longer valid to create an option path from a
plain mapper relationship to an :class:`.AliasedClass` without using
:meth:`.PropComparator.of_type`.
Fixes: #4566
Change-Id: Ic547a1c8408e41aec66ef9644aac7f76f50dd064
Diffstat (limited to 'lib/sqlalchemy/orm/util.py')
-rw-r--r-- | lib/sqlalchemy/orm/util.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index f9258895d..7b8edd349 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -1265,8 +1265,10 @@ def _entity_corresponds_to_use_path_impl(given, entity): return ( entity.is_aliased_class and not entity._use_mapper_path - and given is entity - or given in entity._with_polymorphic_entities + and ( + given is entity + or given in entity._with_polymorphic_entities + ) ) elif not entity.is_aliased_class: return given.common_parent(entity.mapper) |