Opened 9 years ago

Closed 8 years ago

#3450 closed (fixed)

Make IntegrityError available from django.db

Reported by: enlight Owned by: adrian
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 9 years ago.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by enlight

comment:1 Changed 9 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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

comment:2 Changed 9 years ago by Michael Radziej <mir@…>

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

comment:3 Changed 9 years ago by Simon G. <dev@…>

  • Triage Stage changed from Accepted to Ready 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 Changed 8 years ago by mtredinnick

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

comment:5 Changed 8 years ago by mtredinnick

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

(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