Ticket #1048: middleware-sessions_r1303.diff

File middleware-sessions_r1303.diff, 1.6 KB (added by Jiri Barton <jbar@…>, 19 years ago)
  • middleware/sessions.py

     
    6666        try:
    6767            modified = request.session.modified
    6868        except AttributeError:
    69             modified = False
    70         if modified or SESSION_SAVE_EVERY_REQUEST:
    71             session_key = request.session.session_key or sessions.get_new_session_key()
    72             new_session = sessions.save(session_key, request.session._session,
    73                 datetime.datetime.now() + datetime.timedelta(seconds=SESSION_COOKIE_AGE))
    74             expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT")
    75             response.set_cookie(SESSION_COOKIE_NAME, session_key,
    76                 max_age=SESSION_COOKIE_AGE, expires=expires, domain=SESSION_COOKIE_DOMAIN)
     69            pass
     70        else:
     71            if modified or SESSION_SAVE_EVERY_REQUEST:
     72                session_key = request.session.session_key or sessions.get_new_session_key()
     73                new_session = sessions.save(session_key, request.session._session,
     74                    datetime.datetime.now() + datetime.timedelta(seconds=SESSION_COOKIE_AGE))
     75                expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT")
     76                response.set_cookie(SESSION_COOKIE_NAME, session_key,
     77                    max_age=SESSION_COOKIE_AGE, expires=expires, domain=SESSION_COOKIE_DOMAIN)
    7778        return response
Back to Top