diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-05-31 18:29:16 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-05-31 18:29:16 -0400 |
commit | f784ac6dbae7b8fe07e9d898527a7a27dba2b3e4 (patch) | |
tree | 95b3cb0d80d8e5327aee263f6a11287db7c061f0 | |
parent | 0b0ff18b83c5beb9ef8ffa5c838c9eb16d879b02 (diff) | |
download | sqlalchemy-f784ac6dbae7b8fe07e9d898527a7a27dba2b3e4.tar.gz |
express the check for 'filter' in terms of _MapperEntity being present or not.
move away slightly from the _mapper_entities collection.
-rw-r--r-- | lib/sqlalchemy/orm/query.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 54e864abb..98f9885a3 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -1866,7 +1866,13 @@ class Query(object): context.runid = _new_runid() - filtered = bool(list(self._mapper_entities)) + for ent in self._entities: + if isinstance(ent, _MapperEntity): + filtered = True + break + else: + filtered = False + single_entity = filtered and len(self._entities) == 1 if filtered: |