#31982: Convert max_age to an int in set_cookie()
--------------------------------------+------------------------------------
     Reporter:  Matt Johnson          |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  HTTP handling         |                  Version:  3.1
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  1                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by felixxm):

 * 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.

-- 
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/066.edd4d53411dc5455b7663328c864ff2b%40djangoproject.com.

Reply via email to