Opened 18 years ago
Closed 18 years ago
#3463 closed (fixed)
EmptyQuerySet's iterator() method does not return a generator
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
>>> User.objects.all().iterator() <generator object at 0xb76a714c> >>> User.objects.none().iterator() Traceback (most recent call last): File "<console>", line 1, in ? File "./django/db/models/query.py", line 596, in iterator raise StopIteration StopIteration
Attachments (1)
Change History (4)
by , 18 years ago
Attachment: | iterator.diff added |
---|
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 18 years ago
Just noting here that it was [4394] that broke the QuerySet.iterator() interface.
comment:3 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Patch comments:
none().iterator()
.cursor()
calls after the_get_sql_clause()
to avoid unnecessary grabbing of a cursor._get_sql_clause
that always raises EmptyResultSet.iterator
method so that the parent method gets used instead.