django-afip icon indicating copy to clipboard operation
django-afip copied to clipboard

Transaction management

Open WhyNotHugo opened this issue 3 years ago • 2 comments

Validating recepts handles DB transactions by itself just fine.

Using this can be dangerous:

with transaction.atomic()
    receipt.validate()

If there's a failure during this call, the can be irrecoverable data loss. validate() should internally check that no transaction is ongoing, and raise ProgramingError() if it is being run inside a transaction.

WhyNotHugo avatar May 14 '22 18:05 WhyNotHugo

Error message should suggest reading the validate() docstring.

WhyNotHugo avatar May 14 '22 18:05 WhyNotHugo

May be a check if validate is not running in an atomic context should be fine?

juanpsenn avatar May 14 '22 18:05 juanpsenn