Well I would say if you don't have any try except blocks to catch the exceptions triggering the rollback than everything will be rolled back, as the exception will propagate to the topmost with transaction.atomic()
from a_first_function()
, even if it is raised from a_third_function_fails()
However if you were to catch the exception in a_third_function_fails
which means you would also have to do something like:
def a_third_function_fails():
try:
with transaction.atomic():
do_something_wrong()
except:
pass
Then you would have the third function roll back and not the second function because you are implicitly creating a savepoint when you call with transaction.atomic()
from a_third_function_fails
.