On Sun, Jun 28, 2009 at 11:14 PM, sico <allensi...@gmail.com> wrote:

>
> [snip]
>
> However, I am still curious if there is a way to tell django to not
> commit the transaction without the user seeing an exception????
>
>
Yes and no: I tried to describe that in my previous answer.  Yes, you can
arrange to have the transaction be rolled back instead of being committed,
and you can avoid having exceptions reflected to the user.  But no, there is
no setting to tell Django to automatically rollback on error and not
propagate the exception resulting from the error: your code must do that.

First you have to use manual transaction management, so that you control
when the updates get committed.  If you use the default autocommit behavior
you cannot roll back already completed updates as they will be automatically
committed as they are executed.

Then you need to be aware, in your code, of what statements might raise
exceptions.  You must write your code to explicitly handle the cases where
exceptions may be raised and "do the right thing" instead of having them
just propagate up and be reported as server errors.

Karen

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to