Opened 17 years ago

Closed 16 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: dev
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: no UI/UX: no

Description

Attachments (2)

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

Download all attachments as: .zip

Change History (12)

by Gary Wilson <gary.wilson@…>, 17 years ago

Attachment: 3511.diff added

comment:1 by Gary Wilson <gary.wilson@…>, 17 years ago

Has patch: set
Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedDesign decision needed

comment:2 by James Bennett, 17 years ago

Keywords: sprintsept14 added
Triage Stage: Design decision neededAccepted

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

comment:3 by cheeming, 16 years ago

Owner: changed from nobody to cheeming

comment:4 by cheeming, 16 years ago

Status: newassigned

by cheeming, 16 years ago

Attachment: 3511.2.diff added

Base of trunk r6781, fixed test and updated documentation

comment:5 by cheeming, 16 years ago

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

comment:6 by cheeming, 16 years ago

Needs documentation: unset
Needs tests: unset
Owner: cheeming removed
Status: assignednew
Triage Stage: AcceptedReady for checkin

comment:7 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

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

comment:8 by cheeming <cheeming@…>, 16 years ago

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

comment:9 by Armin Ronacher, 16 years ago

Resolution: fixed
Status: closedreopened

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

comment:10 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: reopenedclosed

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