#33562: set_cookie and set_signed_cookie should accept timedelta object for
max_age
argument
-----------------------------------------+------------------------
Reporter: Luke Plant | Owner: nobody
Type: New feature | Status: new
Component: HTTP handling | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
This already works for `get_signed_cookie`:
{{{#!python
>>> request.get_signed_cookie("mykey", max_age=timedelta(days=3))
}}}
This is due to the underlying behaviour of `TimestampSigner`, which was
fixed to do this in #21363.
But for `set_cookie` and `set_signed_cookie` it accepts only a number:
{{{#!python
>>> response = HttpResponse()
>>> response.set_cookie("mykey", max_age=timedelta(days=3))
TypeError: int() argument must be a string, a bytes-like object or a
number, not 'datetime.timedelta'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33562>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107017f59d51ec6-db17abb6-df07-4f17-8887-260fd7f48f74-000000%40eu-central-1.amazonses.com.