Django

Code

Ticket #3511 (closed: fixed)

Opened 2 years ago

Last modified 1 year ago

use a MultipleObjectsReturned exception instead of assert statement in QuerySet.get()

Reported by: Gary Wilson <gary.wilson@gmail.com> Assigned to:
Milestone: Component: Database layer (models, ORM)
Version: SVN Keywords: sprintsept14 sprintdec01
Cc: cheeming@gmail.com, bjorn@exoweb.net Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Attachments

3511.diff (2.4 kB) - added by Gary Wilson <gary.wilson@gmail.com> on 02/16/07 14:16:47.
3511.2.diff (4.2 kB) - added by cheeming on 12/01/07 04:02:02.
Base of trunk r6781, fixed test and updated documentation

Change History

02/16/07 14:16:47 changed by Gary Wilson <gary.wilson@gmail.com>

  • attachment 3511.diff added.

02/16/07 14:17:09 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_better_patch changed.
  • has_patch set to 1.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests set to 1.
  • needs_docs set to 1.

09/16/07 11:37:18 changed by ubernostrum

  • keywords set to sprintsept14.
  • stage changed from Design decision needed to Accepted.

I'd be +1 on this; AssertionError is not the right exception for this situation. Bumping to accepted.

12/01/07 03:41:44 changed by cheeming

  • owner changed from nobody to cheeming.

12/01/07 03:42:07 changed by cheeming

  • status changed from new to assigned.

12/01/07 04:02:02 changed by cheeming

  • attachment 3511.2.diff added.

Base of trunk r6781, fixed test and updated documentation

12/01/07 04:35:03 changed by cheeming

  • cc set to cheeming@gmail.com, bjorn@exoweb.net.
  • keywords changed from sprintsept14 to sprintsept14 sprintdec01.

12/01/07 08:24:58 changed by cheeming

  • owner deleted.
  • needs_docs deleted.
  • status changed from assigned to new.
  • needs_tests deleted.
  • stage changed from Accepted to Ready for checkin.

12/02/07 12:21:08 changed by mtredinnick

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

(In [6838]) Fixed #3511 -- Changed QuerySet?.get() to return a MultipleObjectsReturned? exception, rather than an assertion error. Thanks, Gary Wilson and cheeming.

12/03/07 21:37:29 changed by cheeming <cheeming@gmail.com>

Thanks to Bjorn as well, we were pairing this during the Dec 2007 sprint

12/12/07 03:57:45 changed by mitsuhiko

  • status changed from closed to reopened.
  • resolution deleted.

Shouldn't that exception inherit from AssertionError? for backwards compatibility?

12/12/07 16:59:37 changed by mtredinnick

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

No, it shouldn't. It's not an assertion error (assertion errors are things that should never, ever happen and, if they do, it's a programmer error). You can have missing database objects in the normal course of events.


Add/Change #3511 (use a MultipleObjectsReturned exception instead of assert statement in QuerySet.get())




Change Properties
Action