On 24 avr. 2012, at 18:18, John Begeman <begem...@gmail.com> wrote:
> I'm having some issues with commit_on_success.  It appears to be
> committing prematurely, and I'm not quite sure why.
> 
> I have the following code:
> 
> @transaction.commit_on_success
> def test():
>    s = Somemodel.objects.all()[0]
>    s.hostname = 'this_is_a_test'
>    s.save()
>    raise AttributeError('oh no')
> 
>>>> test()
>    AttributeError: oh no
> 
> This code produces these queries:
> ...
> 6 Query        UPDATE somemodel` SET `hostname` = 'this_is_a_test' ...
> 6 Query    commit
> 
> 
> I don't understand why my update is being committed, is there
> something I'm missing here?

Just in case, is TransactionMiddleware enabled?

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