Merge branch 'master' of https://github.com/mjtamlyn/mongoengine into transform_update
This commit is contained in:
commit
aa9ed614ad
@ -1365,6 +1365,7 @@ class QuerySet(object):
|
||||
raise OperationError(u'Update failed [%s]' % unicode(e))
|
||||
|
||||
def __iter__(self):
|
||||
self.rewind()
|
||||
return self
|
||||
|
||||
def _sub_js_fields(self, code):
|
||||
|
@ -570,7 +570,13 @@ class QuerySetTest(unittest.TestCase):
|
||||
people1 = [person for person in queryset]
|
||||
people2 = [person for person in queryset]
|
||||
|
||||
# Check that it still works even if iteration is interrupted.
|
||||
for person in queryset:
|
||||
break
|
||||
people3 = [person for person in queryset]
|
||||
|
||||
self.assertEqual(people1, people2)
|
||||
self.assertEqual(people1, people3)
|
||||
|
||||
def test_repr_iteration(self):
|
||||
"""Ensure that QuerySet __repr__ can handle loops
|
||||
|
Loading…
x
Reference in New Issue
Block a user