Opened 19 years ago

Closed 19 years ago

Last modified 17 years ago

#508 closed defect (fixed)

max_age for cookies doesn't work in safari (and perhaps not IE)

Reported by: mark@… Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The max_age setting for a cookie is ignored in safari. set_cookie needs to support expires.

Attachments (1)

cookie.patch (1.6 KB ) - added by Andreas 19 years ago.
"expires"-attribute for sessions and cookies

Download all attachments as: .zip

Change History (4)

comment:1 by mark@…, 19 years ago

here is a patch to allow expired to be used as well

Index: django/utils/httpwrappers.py
===================================================================
--- django/utils/httpwrappers.py (revision 640)
+++ django/utils/httpwrappers.py (working copy)
@@ -168,9 +168,9 @@

return True

return False


  • def set_cookie(self, key, value=, max_age=None, path='/', domain=None, secure=None):

+ def set_cookie(self, key, value=, max_age=None, expires=None, path='/', domain=None, secure=None):

self.cookies[key] = value

  • for var in ('max_age', 'path', 'domain', 'secure'):

+ for var in ('max_age', 'path', 'domain', 'secure' , 'expires'):

val = locals()[var]
if val is not None:

self.cookies[key][var.replace('_', '-')] = val

comment:2 by Andreas, 19 years ago

Cookies and Sessions were per-browser-session-only for me in both IE 6 and Opera 8.5. I'll attach a patch in a minute.

by Andreas, 19 years ago

Attachment: cookie.patch added

"expires"-attribute for sessions and cookies

comment:3 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(In [1035]) Fixed #508 -- Added support for 'expires' in cookies and changed session middleware to set 'expires' in addition to 'max_age'. Thanks, mark@…

Note: See TracTickets for help on using tickets.
Back to Top