Opened 18 years ago
Closed 17 years ago
#3440 closed (fixed)
DateQuerySet.iterator not iterable if empty
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | queryset-refactor |
Severity: | Keywords: | qs-rf-fixed | |
Cc: | Triage Stage: | Fixed on a branch | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The changes in r4394 to support empty QuerySets does not work for DateQuerySet.iterator()
because the method is not a generator, but instead returns an iterable. Instead of raising a StopIteration
it should return an empty list.
Also, the other methods that are generators (e.g. QuerySet.iterator()
) raise a StopIteration
when they could simply return.
Attachments (3)
Change History (9)
by , 18 years ago
Attachment: | datequeryset.patch added |
---|
comment:2 by , 17 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
Summary: | DateQuerySet.iterator not iterable if empty → [patch] DateQuerySet.iterator not iterable if empty |
This ticket has been marked as duplicate, but it's not. EmptyQuerySet and DateQuerySet are two different classes, and even though the former has been fixed in #3463, DateQuerySet.iterator is still not working right. It's a function at the moment, not a generator. And for empty results list it raises StopIteration that acts as an uncaught exception. This happens in admin for date_hierarchy filter for fields with null=True, for example.
comment:3 by , 17 years ago
Summary: | [patch] DateQuerySet.iterator not iterable if empty → DateQuerySet.iterator not iterable if empty |
---|
comment:4 by , 17 years ago
Triage Stage: | Unreviewed → Fixed on a branch |
---|---|
Version: | SVN → queryset-refactor |
This is fixed in the qsrf branch.
comment:5 by , 17 years ago
Keywords: | qs-rf-fixed added |
---|
comment:6 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
(In [7477]) Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
Diff against r4460