Amazing work Christophe, congrats!
Lot's of new cool stuff being added to 1.6, looking forward to it.
Regarding the nested xact context managers, let's say something that I don't like happened and I want to abort everything:
with xact(using=db1):
with xact(using=db2):
obj1 = Ob1.save(using=db1)
obj2 = Obj2.save(using=db2)
if not_cool:
raise Rollback
I'll raise Rollback since this is the way to force a rollback, as described in the README.
But, this will roll back only whatever happened in the inner context manager, thus obj1 will still exist, right?
Is there a way to make the Rollback reach the outer xact?
You wrote in a previous email that an exception will abort both, so something like this should be the solution? (I have not tested):
try:
with xact(using=db1):
with xact(using=db2):
obj1 = Ob1.save(using=db1)
obj2 = Obj2.save(using=db2)
if not_cool:
raise Exception
except Exception:
return False
return True
Cheers,
Leandro