Opened 18 years ago

Closed 18 years ago

#3450 closed (fixed)

Make IntegrityError available from django.db

Reported by: enlight Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: 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

This is related to ticket #3083, however the issue I'd like to address is just a subset of that ticket, so I figured it's best to create a separate ticket. The attached patch will allow developers to import IntegrityError from django.db thus avoiding a dependency on any specific db module. I mentioned the rationale for this patch in this thread on django-users.

I have tested the changes on the postgresql and postgresql_psycopg2 backends, and I've looked at api/source for the oracle, mysql, ado_mssql and sqlite3 db modules recommended for use with the other backends. From what I could gather they all provide an IntegrityError as specified by the Python DB-API 2.0... still would be best if someone actually tested all those backends :)

Attachments (1)

IntegrityError.diff (3.8 KB ) - added by enlight 18 years ago.

Download all attachments as: .zip

Change History (6)

by enlight, 18 years ago

Attachment: IntegrityError.diff added

comment:1 by Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedAccepted

I'm +1 - it does make sense to make this database independant.

comment:2 by Michael Radziej <mir@…>, 18 years ago

Simon, what's missing for "Ready for Checkin"? Do you think there should be docs?

comment:3 by Simon G. <dev@…>, 18 years ago

Triage Stage: AcceptedReady for checkin

Hi Michael, I think I was being overly cautious :) I like the idea, but thought that one of the core's might have comments to make. I'll shift it to RFC.

comment:4 by Malcolm Tredinnick, 18 years ago

Ticket #1515 contains a potentially better way to do this, although my comment there explains why I'm not committing that yet.

comment:5 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [5076]) Fixed #3450 -- Exposed IntegrityError in a backend-neutral fashion. This is a
useful error to be able to catch explicitly. Thanks, enlight.

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