return instead of raising StopIteration
This commit is contained in:
parent
a1494c4c93
commit
15451ff42b
@ -1461,7 +1461,7 @@ class BaseQuerySet(object):
|
|||||||
"""Wrap the result in a :class:`~mongoengine.Document` object.
|
"""Wrap the result in a :class:`~mongoengine.Document` object.
|
||||||
"""
|
"""
|
||||||
if self._limit == 0 or self._none:
|
if self._limit == 0 or self._none:
|
||||||
raise StopIteration
|
return
|
||||||
|
|
||||||
raw_doc = self._cursor.next()
|
raw_doc = self._cursor.next()
|
||||||
|
|
||||||
|
@ -89,10 +89,10 @@ class QuerySet(BaseQuerySet):
|
|||||||
yield self._result_cache[pos]
|
yield self._result_cache[pos]
|
||||||
pos += 1
|
pos += 1
|
||||||
|
|
||||||
# Raise StopIteration if we already established there were no more
|
# return if we already established there were no more
|
||||||
# docs in the db cursor.
|
# docs in the db cursor.
|
||||||
if not self._has_more:
|
if not self._has_more:
|
||||||
raise StopIteration
|
return
|
||||||
|
|
||||||
# Otherwise, populate more of the cache and repeat.
|
# Otherwise, populate more of the cache and repeat.
|
||||||
if len(self._result_cache) <= pos:
|
if len(self._result_cache) <= pos:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user