settings: use MIDDLEWARE (#38393)

This commit is contained in:
Emmanuel Cazenave 2019-12-11 10:45:47 +01:00 committed by Frédéric Péters
parent 6c7449d49a
commit 7050df871a
2 changed files with 4 additions and 2 deletions

View File

@ -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 = {}

View File

@ -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',