summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Cazenave <ecazenave@entrouvert.com>2019-12-11 09:45:47 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2020-01-12 20:53:59 (GMT)
commit22a8d3d86774a8581c4f9b2814915b1fe3be0a51 (patch)
treec84ad9efb7dd945fbd73775185fc52b70c661204
parent6c7449d49ada5af24b66a5d78a88179ae07322c8 (diff)
downloadcombo-wip/38393-utiliser-middleware-dans-les-set.zip
combo-wip/38393-utiliser-middleware-dans-les-set.tar.gz
combo-wip/38393-utiliser-middleware-dans-les-set.tar.bz2
settings: use MIDDLEWARE (#38393)wip/38393-utiliser-middleware-dans-les-set
-rw-r--r--combo/middleware.py4
-rw-r--r--combo/settings.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/combo/middleware.py b/combo/middleware.py
index 1300aaf..03c0e8d 100644
--- a/combo/middleware.py
+++ b/combo/middleware.py
@@ -16,6 +16,8 @@
import threading
+from django.utils.deprecation import MiddlewareMixin
+
_requests = {}
@@ -23,7 +25,7 @@ def get_request():
return _requests.get(threading.current_thread())
-class GlobalRequestMiddleware(object):
+class GlobalRequestMiddleware(MiddlewareMixin):
def process_request(self, request):
_requests[threading.current_thread()] = request
request.cache = {}
diff --git a/combo/settings.py b/combo/settings.py
index 0d227f8..8d2982e 100644
--- a/combo/settings.py
+++ b/combo/settings.py
@@ -85,7 +85,7 @@ INSTALLED_APPS = (
'xstatic.pkg.leaflet_markercluster',
)
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE = (
'combo.middleware.GlobalRequestMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',