Code

Ticket #4119: middleware.py.3.diff

File middleware.py.3.diff, 938 bytes (added by Ciantic, 7 years ago)

Same fix, but apparenlty assumption of GMT convert was wrong. This uses utcnow again.

Line 
1Index: django/contrib/sessions/middleware.py
2===================================================================
3--- django/contrib/sessions/middleware.py       (revision 5059)
4+++ django/contrib/sessions/middleware.py       (working copy)
5@@ -94,7 +94,7 @@
6                     expires = None
7                 else:
8                     max_age = settings.SESSION_COOKIE_AGE
9-                    expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT")
10+                    expires = (datetime.datetime.utcnow() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE)).ctime()
11                 new_session = Session.objects.save(session_key, request.session._session,
12                     datetime.datetime.now() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE))
13                 response.set_cookie(settings.SESSION_COOKIE_NAME, session_key,