Make IntegrityError available from django.db
|Reported by:||enlight||Owned by:||Adrian Holovaty|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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 :)