Hey! I've been recently working (porting to Django 1.8) on a project where we need to use a few transactions in a single request, and these transactions cannot be correctly handled by the `atomic` decorator due to functions calls nesting. Basically, we are sending celery tasks at the end of some processing, and it requires the results to be visible in the database. I'm doing this for each element of a list, thus the celery task sending is done right after saving the data to the database. The commit should happen between the save and posting the task, and since the processing logic is complex, I can't use a decorator here.
The issue is, when autocommit is set to off, whenever I try to `.update()` a `QuerySet` or `.save()` a `Model`, it results in `TransactionManagementError: The outermost 'atomic' block cannot use savepoint = False when autocommit is off.` error, which is kind of sad because I could handle the eventual rollback myself gracefully. Instead, django throws me this error in the face. Have you got any solution to this? My logic looks more or less like this: def process_events(events): # ...some generic logic here... transaction.set_autocommit(False) for event in events: react_to_event(event) # ...finalization... def react_to_event(event): if event.a: do_a(event) elif event.b: do_b(event) elif event.c: do_c(event) else: do_err(event) def do_[abc](event): # ...process changes... event.save() # Make the changes visible to celery tasks and others. transaction.commit() # ...run signals... # ...send celery tasks... Cheers -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/85267e52-f584-4864-9b49-6e7f96890702%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.