summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2022-03-04 12:57:10 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-03-07 07:57:14 +0100
commitae2da5ba652c1a11cd88dcb119744dcecaeb03ee (patch)
tree5f79e182a07457487abe2f0108a2f1f65ad8a72d /docs
parent1882f6567df361f52e53b555b2faa677361e128a (diff)
Fixed #33562 -- Made HttpResponse.set_cookie() support timedelta for the max_age argument.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/request-response.txt12
-rw-r--r--docs/releases/4.1.txt3
2 files changed, 11 insertions, 4 deletions
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``
diff --git a/docs/releases/4.1.txt b/docs/releases/4.1.txt
index 9e682e6cc2..72c1c15c7a 100644
--- a/docs/releases/4.1.txt
+++ b/docs/releases/4.1.txt
@@ -281,7 +281,8 @@ Models
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~
-* ...
+* :meth:`.HttpResponse.set_cookie` now supports :class:`~datetime.timedelta`
+ objects for the ``max_age`` argument.
Security
~~~~~~~~