Friday, January 30, 2015

Middleware + Transactions

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/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/54CB8E78.7060604%40tbz-pariv.de.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment