* cc: Florian Apolloner, Adam (Chainz) Johnson (added)
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Agreed, we should also mention this in
[https://docs.djangoproject.com/en/3.1/ref/request-
response/#django.http.HttpResponse.set_cookie docs], e.g.:
> `max_age` should be **an integer** number of seconds, ...
Replying to [ticket:31982 Matt Johnson]:
> 1. Do we only convert floats where the decimal part is 0? Or do we round
or truncate?
> 2. If we can't successfully convert to an int, do we throw an exception,
or just pass in the original value?
I would simply call `int(max_age)` without catching exceptions.
--
Ticket URL: <https://code.djangoproject.com/ticket/31982#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Adam (Chainz) Johnson):
+1 to calling `int()`
--
Ticket URL: <https://code.djangoproject.com/ticket/31982#comment:2>
* owner: nobody => Hasan Ramezani
* status: new => assigned
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/31982#comment:3>
* needs_tests: 0 => 1
Comment:
[https://github.com/django/django/pull/13386 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31982#comment:4>
* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/31982#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"d2d08c8cf6ed601d52e25cb8fc7944d39b5ed56e" d2d08c8]:
{{{
#!CommitTicketReference repository=""
revision="d2d08c8cf6ed601d52e25cb8fc7944d39b5ed56e"
Fixed #31982 -- Made HttpResponse.set_cookie() cast max_age argument to an
integer.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31982#comment:6>