﻿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
14588	Changed behaviour of middlewares after [14393]	Petr Marhoun <petr.marhoun@…>	nobody	"Documentation says:

Unlike the process_request() and process_view() methods, the process_response() method is always called, even if the process_request() and process_view() methods of the same middleware class were skipped because an earlier middleware method returned an HttpResponse.

But after [14393] response middleware are called only if there is no response from process_request or process_view or process_exception or Http404 or PermissionDenied.

It is problematic with transaction middleware - it is necessary to call process_response or process_exception to close open transaction. But if process_response returns response, transaction is still opened and stacked. And if there is something outside transaction in the following request in the same thread, it is not committed - for example session middleware could be outside, it would be impossible to login.

I also found one bug in my code - if process_exception returns response, following exception middlewares are skipped and transaction could be closed in ThreadMiddleware.process_response. So there was commit, not rollback (before [14393]). It was logical consequence of the documentation, but maybe there could be a note about it.
"		closed	Core (Other)	dev		fixed		Mikhail Korobov	Accepted	0	0	0	0	0	0
