From c86d34a935519aa59b3c04b0845f6c8a6ef80fbd Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sun, 15 Jan 2006 06:18:15 +0000 Subject: [PATCH] magic-removal: Merged to [1978] git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1979 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 + django/contrib/sessions/middleware.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 92581cf547..e9316b700d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -35,6 +35,7 @@ answer newbie questions, and generally made Django that much better: Andreas David Ascher Arthur + Jiri Barton James Bennett Paul Bissex Simon Blanchard diff --git a/django/contrib/sessions/middleware.py b/django/contrib/sessions/middleware.py index 7032acd49a..2e744e403a 100644 --- a/django/contrib/sessions/middleware.py +++ b/django/contrib/sessions/middleware.py @@ -69,12 +69,13 @@ class SessionMiddleware: try: modified = request.session.modified except AttributeError: - modified = False - if modified or SESSION_SAVE_EVERY_REQUEST: - session_key = request.session.session_key or Session.objects.get_new_session_key() - new_session = Session.objects.save(session_key, request.session._session, - datetime.datetime.now() + datetime.timedelta(seconds=SESSION_COOKIE_AGE)) - expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT") - response.set_cookie(SESSION_COOKIE_NAME, session_key, - max_age=SESSION_COOKIE_AGE, expires=expires, domain=SESSION_COOKIE_DOMAIN) + pass + else: + if modified or SESSION_SAVE_EVERY_REQUEST: + session_key = request.session.session_key or Session.objects.get_new_session_key() + new_session = Session.objects.save(session_key, request.session._session, + datetime.datetime.now() + datetime.timedelta(seconds=SESSION_COOKIE_AGE)) + expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT") + response.set_cookie(SESSION_COOKIE_NAME, session_key, + max_age=SESSION_COOKIE_AGE, expires=expires, domain=SESSION_COOKIE_DOMAIN) return response