Roll back transaction when handling DebusineAPIException
rest_framework.views.exception_handler rolls back the transaction when
handling APIException, but our specialized handling of
DebusineAPIException failed to do so. This probably caused various
issues in our API views, but most notably it meant that we would create
workflows despite immediately-detectable validation errors.
I audited all our API views for patterns that would indicate problems
resulting from this change. The only one I found was also found by the
test suite: UploadFileView.put needs to delete the FileUpload row on
a hash mismatch, and that needs to be committed despite the exception.
I added a rollback_transaction argument to DebusineAPIException to
provide a simple way to control this behaviour.
Fixes: #432 (closed)