From ae2da5ba652c1a11cd88dcb119744dcecaeb03ee Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Fri, 4 Mar 2022 12:57:10 +0000 Subject: Fixed #33562 -- Made HttpResponse.set_cookie() support timedelta for the max_age argument. --- docs/ref/request-response.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'docs/ref/request-response.txt') diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index f651a77c4b..3a3c4d14fc 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -853,9 +853,15 @@ Methods Sets a cookie. The parameters are the same as in the :class:`~http.cookies.Morsel` cookie object in the Python standard library. - * ``max_age`` should be an integer number of seconds, or ``None`` (default) - if the cookie should last only as long as the client's browser session. - If ``expires`` is not specified, it will be calculated. + * ``max_age`` should be a :class:`~datetime.timedelta` object, an integer + number of seconds, or ``None`` (default) if the cookie should last only + as long as the client's browser session. If ``expires`` is not specified, + it will be calculated. + + .. versionchanged:: 4.1 + + Support for ``timedelta`` objects was added. + * ``expires`` should either be a string in the format ``"Wdy, DD-Mon-YY HH:MM:SS GMT"`` or a ``datetime.datetime`` object in UTC. If ``expires`` is a ``datetime`` object, the ``max_age`` -- cgit v1.3