﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7241	Transaction management does not catch all exceptions	jim <jim-django@…>	nobody	"Expectation:
When a view is decorated with commit_on_success, any exception raised in that view should cause a rollback of the current transaction. If no exception occurs, the transaction should be committed. 

Experience:
There are many exceptions that are not caught by commit_on_success. When one of these is raised, neither a rollback nor a commit is done. This causes a TransactionManagementError in leave_transaction_management().

The only exceptions caught are subclasses of Python's built in Exception class. Since Python allows any object to be raised as an exception, this leaves an unprotected path in the code.

For example (untested, just an illustration):
{{{
@commit_on_success
def my_view(request):
   raise ""simple debug exception""
}}}

The object being raised will not match commit_on_success's handler, and the error condition is triggered.

Note: Yes, string exceptions are deprecated. But they are still possible, and must be guarded against.

Simple patch attached."		closed	Database layer (models, ORM)	dev		fixed			Accepted	1	0	0	0	0	0
