maas-devel team mailing list archive
-
maas-devel team
-
Mailing list archive
-
Message #01436
TransactionMiddleware deprecated
TransactionMiddleware is deprecated in Django 1.6 [1], and a reasonable
replacement seems to be to set ATOMIC_REQUESTS = True globally.
However:
The transaction middleware applied not only to view functions, but
also to middleware modules that came after it. For instance, if you
used the session middleware after the transaction middleware, session
creation was part of the transaction. ATOMIC_REQUESTS only applies to
the view itself.
The middleware classes after TransactionMiddleware are:
django.middleware.csrf.CsrfViewMiddleware
maasserver.middleware.ExceptionLoggerMiddleware
django.contrib.auth.middleware.AuthenticationMiddleware
django.contrib.messages.middleware.MessageMiddleware
maasserver.middleware.AccessMiddleware
maasserver.middleware.DebuggingLoggerMiddleware
django.middleware.gzip.GZipMiddleware
Do any of those need to be within the view's [2] transaction too? If so,
we'll have to roll our own middleware eventually (though that'll largely
be a case of copying TransactionMiddleware).
[1] https://docs.djangoproject.com/en/1.6/topics/db/transactions/
[2] ATOMIC_REQUESTS is badly named, because it's not promising atomicity
across the whole request, just the view.
Follow ups