Code

Opened 9 years ago

Closed 9 years ago

Last modified 7 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
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: UI/UX:

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 9 years ago.
"expires"-attribute for sessions and cookies

Download all attachments as: .zip

Change History (4)

comment:1 Changed 9 years ago by mark@…

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 Changed 9 years ago by Andreas

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.

Changed 9 years ago by Andreas

"expires"-attribute for sessions and cookies

comment:3 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.