Fixed queryset repr mid iteration

Closes #144
This commit is contained in:
Ross Lawley
2011-06-17 15:04:07 +01:00
parent f3d265bbe0
commit 99f923e27f
3 changed files with 17 additions and 1 deletions

View File

@@ -1524,7 +1524,10 @@ class QuerySet(object):
limit = REPR_OUTPUT_SIZE + 1
if self._limit is not None and self._limit < limit:
limit = self._limit
data = list(self[self._skip:limit])
try:
data = list(self[self._skip:limit])
except pymongo.errors.InvalidOperation:
return ".. queryset mid-iteration .."
if len(data) > REPR_OUTPUT_SIZE:
data[-1] = "...(remaining elements truncated)..."
return repr(data)