Django

Code

Ticket #508 (closed: fixed)

Opened 3 years ago

Last modified 1 year ago

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

Reported by: mark@junklight.com Assigned to: adrian
Milestone: Component: Core framework
Version: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

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

Attachments

cookie.patch (1.6 kB) - added by Andreas on 10/05/05 06:21:31.
"expires"-attribute for sessions and cookies

Change History

09/14/05 10:27:39 changed by mark@junklight.com

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

10/05/05 06:17:56 changed 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.

10/05/05 06:21:31 changed by Andreas

  • attachment cookie.patch added.

"expires"-attribute for sessions and cookies

10/31/05 19:02:08 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #508 (max_age for cookies doesn't work in safari (and perhaps not IE))




Change Properties
Action