magic-removal: Merged to [1978]

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1979 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-01-15 06:18:15 +00:00
parent 34c587e81e
commit c86d34a935
2 changed files with 10 additions and 8 deletions

View File

@ -35,6 +35,7 @@ answer newbie questions, and generally made Django that much better:
Andreas Andreas
David Ascher <http://ascher.ca/> David Ascher <http://ascher.ca/>
Arthur <avandorp@gmail.com> Arthur <avandorp@gmail.com>
Jiri Barton
James Bennett James Bennett
Paul Bissex <http://e-scribe.com/> Paul Bissex <http://e-scribe.com/>
Simon Blanchard Simon Blanchard

View File

@ -69,12 +69,13 @@ class SessionMiddleware:
try: try:
modified = request.session.modified modified = request.session.modified
except AttributeError: except AttributeError:
modified = False pass
if modified or SESSION_SAVE_EVERY_REQUEST: else:
session_key = request.session.session_key or Session.objects.get_new_session_key() if modified or SESSION_SAVE_EVERY_REQUEST:
new_session = Session.objects.save(session_key, request.session._session, session_key = request.session.session_key or Session.objects.get_new_session_key()
datetime.datetime.now() + datetime.timedelta(seconds=SESSION_COOKIE_AGE)) new_session = Session.objects.save(session_key, request.session._session,
expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT") datetime.datetime.now() + datetime.timedelta(seconds=SESSION_COOKIE_AGE))
response.set_cookie(SESSION_COOKIE_NAME, session_key, expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT")
max_age=SESSION_COOKIE_AGE, expires=expires, domain=SESSION_COOKIE_DOMAIN) response.set_cookie(SESSION_COOKIE_NAME, session_key,
max_age=SESSION_COOKIE_AGE, expires=expires, domain=SESSION_COOKIE_DOMAIN)
return response return response