Ticket #5816: 5816.diff

File 5816.diff, 1.2 KB (added by Karen Tracey <kmtracey@…>, 8 years ago)

Restore old date formatting code

  • django/contrib/sessions/middleware.py

     
    11from django.conf import settings
    22from django.utils.cache import patch_vary_headers
    33from email.Utils import formatdate
    4 import datetime
    54import time
    65
    76TEST_COOKIE_NAME = 'testcookie'
     
    3433
    3534                    # Fixed length date must have '-' separation in the format
    3635                    # DD-MMM-YYYY for compliance with Netscape cookie standard
    37                     expires = datetime.datetime.strftime(datetime.datetime.utcnow() + \
    38                               datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT")
    39 
     36                    # Note: strftime cannot be used here since it is locale-dependent
     37                    expires = (rfcdate[:7] + "-" + rfcdate[8:11]
     38                               + "-" + rfcdate[12:26] + "GMT")
    4039                # Save the seesion data and refresh the client cookie.
    4140                request.session.save()
    4241                response.set_cookie(settings.SESSION_COOKIE_NAME,
Back to Top