Hi,

I'm a little confused how I should handle transactions in a particular
situation.

I've got some code that boils down to this:

def myview(request):
    result = important_money_stuff(request)
    widget = Widget.objects.get(request.get(something))
    thingy = Thingy.objects.get(request.get(something))
    thingy, widget = modify(thingy, widget)
    thingy.save()
    widget.save()
    return render_to_response(...)

def important_money_stuff(request):
    bank_reply = something_involving_credit_cards()
    log_to_db(bank_reply)
    return bank_reply

Now - I want to use transactions to ensure that widget and thingy only
get saved on a complete success. I don't want their states to become
out of sync.

However - I want the logging to take place *whatever happens* i.e.
assuming the money stuff happens then I want it logged. I was going to
use commit_on_success to do this.

How does commit_on_success handle being nested?  Will it understand to
commit the logging transaction when it finishes important_money_stuff
but to roll back the widget and thingy transaction separately?

cheers,

Andy

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