This commit is contained in:
Sergey Chvalyuk 2011-10-28 00:23:13 +03:00
parent 4d5f602ee7
commit 1acdb880fc

View File

@ -1609,10 +1609,16 @@ class QuerySet(object):
def __repr__(self):
limit = REPR_OUTPUT_SIZE + 1
if self._limit is not None and self._limit < limit:
limit = self._limit
start = ( 0 if self._skip is None else self._skip )
if self._limit is None:
stop = start + limit
if self._limit is not None:
if self._limit - start > limit:
stop = start + limit
else:
stop = self._limit
try:
data = list(self[self._skip:limit])
data = list(self[start:stop])
except pymongo.errors.InvalidOperation:
return ".. queryset mid-iteration .."
if len(data) > REPR_OUTPUT_SIZE: