Django

Code

Ticket #3440 (closed: fixed)

Opened 1 year ago

Last modified 3 weeks ago

DateQuerySet.iterator not iterable if empty

Reported by: ashleywalsh@gmail.com Assigned to: adrian
Component: Database wrapper Version: queryset-refactor
Keywords: qs-rf-fixed Cc:
Triage Stage: Fixed on a branch Has patch: 1
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

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

datequeryset.patch (0.5 kB) - added by ashleywalsh@gmail.com on 02/05/07 19:24:11.
Diff against r4460
datequeryset.diff (0.5 kB) - added by ashleywalsh@gmail.com on 02/05/07 19:25:47.
correct diff
date__queryset.patch (1.2 kB) - added by zlobnyi antisvin <antisvin@gmail.com> on 12/11/07 04:58:08.
turn DateQueryset?.iterator into generator

Change History

02/05/07 19:24:11 changed by ashleywalsh@gmail.com

  • attachment datequeryset.patch added.

Diff against r4460

02/05/07 19:25:47 changed by ashleywalsh@gmail.com

  • attachment datequeryset.diff added.

correct diff

02/11/07 13:02:19 changed by Michael Radziej <mir@noris.de>

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to duplicate.
  • needs_tests changed.
  • needs_docs changed.

duplicate of #3463

12/11/07 04:57:04 changed by zlobnyi antisvin <antisvin@gmail.com>

  • status changed from closed to reopened.
  • resolution deleted.
  • summary changed from DateQuerySet.iterator not iterable if empty to [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.

12/11/07 04:58:08 changed by zlobnyi antisvin <antisvin@gmail.com>

  • attachment date__queryset.patch added.

turn DateQueryset?.iterator into generator

02/22/08 16:10:02 changed by PJCrosier

  • summary changed from [patch] DateQuerySet.iterator not iterable if empty to DateQuerySet.iterator not iterable if empty.

02/27/08 19:15:37 changed by jacob

  • version changed from SVN to queryset-refactor.
  • stage changed from Unreviewed to Fixed on a branch.

This is fixed in the qsrf branch.

03/31/08 13:54:08 changed by jacob

  • keywords set to qs-rf-fixed.

04/26/08 21:50:16 changed by mtredinnick

  • status changed from reopened to closed.
  • resolution set to fixed.

(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


Add/Change #3440 (DateQuerySet.iterator not iterable if empty)




Change Properties
Action