Opened 9 years ago

Closed 8 years ago

#3511 closed (fixed)

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

Reported by: Gary Wilson <gary.wilson@…> Owned by:
Component: Database layer (models, ORM) Version: master
Severity: Keywords: sprintsept14 sprintdec01
Cc: cheeming@…, bjorn@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Attachments (2)

3511.diff (2.4 KB) - added by Gary Wilson <gary.wilson@…> 9 years ago.
3511.2.diff (4.2 KB) - added by cheeming 8 years ago.
Base of trunk r6781, fixed test and updated documentation

Download all attachments as: .zip

Change History (12)

Changed 9 years ago by Gary Wilson <gary.wilson@…>

comment:1 Changed 9 years ago by Gary Wilson <gary.wilson@…>

  • Has patch set
  • Needs documentation set
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 8 years ago by ubernostrum

  • Keywords sprintsept14 added
  • Triage 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.

comment:3 Changed 8 years ago by cheeming

  • Owner changed from nobody to cheeming

comment:4 Changed 8 years ago by cheeming

  • Status changed from new to assigned

Changed 8 years ago by cheeming

Base of trunk r6781, fixed test and updated documentation

comment:5 Changed 8 years ago by cheeming

  • Cc cheeming@… bjorn@… added
  • Keywords sprintdec01 added

comment:6 Changed 8 years ago by cheeming

  • Needs documentation unset
  • Needs tests unset
  • Owner cheeming deleted
  • Status changed from assigned to new
  • Triage Stage changed from Accepted to Ready for checkin

comment:7 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:8 Changed 8 years ago by cheeming <cheeming@…>

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

comment:9 Changed 8 years ago by mitsuhiko

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:10 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from reopened to closed

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.

Note: See TracTickets for help on using tickets.
Back to Top