Kaydet (Commit) 5ff2ffa3 authored tarafından Matt Robenolt's avatar Matt Robenolt Kaydeden (comit) Aymeric Augustin

Define the SessionStore inside __init__ instead of process_request

It's unnecessary to run this on every request, since technically, settings *should be* immutable.
üst 64cdea68
...@@ -6,10 +6,13 @@ from django.utils.http import cookie_date ...@@ -6,10 +6,13 @@ from django.utils.http import cookie_date
from django.utils.importlib import import_module from django.utils.importlib import import_module
class SessionMiddleware(object): class SessionMiddleware(object):
def process_request(self, request): def __init__(self):
engine = import_module(settings.SESSION_ENGINE) engine = import_module(settings.SESSION_ENGINE)
self.SessionStore = engine.SessionStore
def process_request(self, request):
session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None) session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)
request.session = engine.SessionStore(session_key) request.session = self.SessionStore(session_key)
def process_response(self, request, response): def process_response(self, request, response):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment