Middleware + Transactions

11 views
Skip to first unread message

Thomas Güttler

unread,
Jan 30, 2015, 9:01:28 AM1/30/15
to Django users
Dear Django developers,

we currently have the following issue when upgrading from Django 1.5 to Django 1.6:
https://github.com/etianen/django-reversion/issues/268

As it seems, since Django 1.6, middlewares are not supposed to be executed within the same transaction as the view
function is.

We would like to understand why that is the default behavior now and we are supposed to re-organize our code base to
work with that changes.

What is the rationale behind middlewares not being executed within the same transaction as the view function?

Furthermore, decorating all view functions as suggested here
http://django-reversion.readthedocs.org/en/latest/api.html#revisionmiddleware is quite not feasible for large projects.
Especially given that reversion is not the only middleware that needs to be executed within the same transaction as the
view function. It would basically mean that each view function needs to be decorated potentially n times.


We understand that transactions might effect performance, thus lesser transactions being in a transaction means faster
execution. However, shouldn't there be the possibility to include distinct middlewares into the view transaction?

Regards,
Thomas Güttler

--
Thomas Güttler
http://thomas-guettler.de/
Reply all
Reply to author
Forward
0 new messages