Django

Code

Ticket #3450 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

Make IntegrityError available from django.db

Reported by: enlight Assigned to: adrian
Milestone: Component: Database layer (models, ORM)
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

IntegrityError.diff (3.8 kB) - added by enlight on 02/07/07 00:45:19.

Change History

02/07/07 00:45:19 changed by enlight

  • attachment IntegrityError.diff added.

02/10/07 04:38:54 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

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

03/07/07 02:35:01 changed by Michael Radziej <mir@noris.de>

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

03/07/07 02:42:23 changed by Simon G. <dev@simon.net.nz>

  • 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.

03/10/07 05:12:05 changed by mtredinnick

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

04/25/07 05:18:56 changed by mtredinnick

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

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


Add/Change #3450 (Make IntegrityError available from django.db)




Change Properties
Action