summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Cazenave <ecazenave@entrouvert.com>2019-12-11 09:45:47 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2020-01-13 16:55:12 (GMT)
commit7050df871a3f932fb3eb826faf51a2bbc9ba1737 (patch)
treec84ad9efb7dd945fbd73775185fc52b70c661204
parent6c7449d49ada5af24b66a5d78a88179ae07322c8 (diff)
downloadcombo-7050df871a3f932fb3eb826faf51a2bbc9ba1737.zip
combo-7050df871a3f932fb3eb826faf51a2bbc9ba1737.tar.gz
combo-7050df871a3f932fb3eb826faf51a2bbc9ba1737.tar.bz2
settings: use MIDDLEWARE (#38393)
-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',