Sunday, June 13, 2010

Re: IntegrityError exception not caught by Django

> Can anybody figure out why the IntegrityError doesn't get thrown till
> then ?
> Why didn't Django catch errors thrown in middleware ?

Most likely the foreign keys are defined as "deferrable initially
deferred", meaning that the database doesn't check them before commit.
And this of course means that Django can't catch the error before
commit.

From the error message it seems like you are using Postgres, you can
check if this is the case by running manage.py dbshell and then type
"\d traffic_tracking2010". From the output you should see the
deferrable initially deferred on the foreign key. You could manually
disable the deferred behavior, but I don't know what this breaks.
Probably something, as there must be some reason for Django using
deferred checking.

--
Anssi

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate