Django

Code

Ticket #7770 (new)

Opened 2 months ago

Last modified 5 days ago

HttpResponse.set_cookie should accept expires=datetime

Reported by: jdunck Assigned to: nobody
Milestone: Component: HTTP handling
Version: SVN Keywords:
Cc: goliath.mailinglist@gmx.de Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

Description

set_cookie accepts a keyword argument, expires, which is expected to be an RFC-formatted string for datetime.

It should (also?) accept a datetime and possibly epoch-seconds.

In general, set_cookie may need to be reviewed for usefulness.

See also: #6657

Attachments

cookie-datetime.diff (1.2 kB) - added by phatmonkey on 07/15/08 20:16:38.

Change History

07/15/08 20:16:38 changed by phatmonkey

  • attachment cookie-datetime.diff added.

07/15/08 20:59:08 changed by serialx

  • has_patch set to 1.
  • stage changed from Unreviewed to Accepted.

Looks good to me.

07/16/08 03:39:25 changed by David Danier <goliath.mailinglist@gmx.de>

Perhaps max_age could accept a timedelta-object as well? Perhaps even a datetime-object would be possible for max_age (converted to timedelta, converted to seconds)?

07/16/08 03:52:41 changed by David Danier <goliath.mailinglist@gmx.de>

  • cc set to goliath.mailinglist@gmx.de.

07/16/08 04:19:49 changed by phatmonkey

Perhaps it should generate both from one argument? They are essentially the same thing. It would be nice if there were default settings for domain, path, secure and expires (as a timedelta?) too.

07/16/08 12:41:45 changed by mtredinnick

  • milestone deleted.

Removing milestone. If we get to it before 1.0, well and good. If not, it's not backwards incompatible, so it could wait until afterwards.

08/25/08 17:30:23 changed by SmileyChris

  • needs_tests set to 1.

Yep, it should definitely generate the max-age (if it wasn't explicitly given).


Add/Change #7770 (HttpResponse.set_cookie should accept expires=datetime)




Change Properties
Action