On Thu, Jul 1, 2010 at 8:05 PM, Mark Bucciarelli <mkb...@gmail.com> wrote: > On Wed, Jun 30, 2010 at 7:14 PM, Russell Keith-Magee > <russ...@keith-magee.com> wrote: >> >> It appears that MonetDB is behaving the same way as PostgreSQL. The >> right approach in the test is to catch the exception and roll back the >> cursor. >> > > In 1.2 I see full_clean() and ValidationError let's > me handle this in application code in a way that > is independent of the backend. > > Is there a 1.1 way to do this so I don't have to > know the backend so I can catch the right > exception? > > I couldn't figure out anyway to do this inside > the db driver.
1.1 provides an alias for the underlying database IntegrityError and DatabaseError. This means you can import from django.db import IntegrityError which allows you to catch IntegrityError (as in, you can have a try/except block and you don't need to change code on a per-backend basis), but you can't rely on the internal implementation of the exception being consistent. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.