Adi Roiban
2015-10-25 08:34:15 UTC
Hi,
This message is based on https://twistedmatrix.com/trac/ticket/5911#comment:14
In twisted/web/http.py we have the addCookie method which has the
'max_age' argument.
In the current code, the max_age is used as just anything which can be
converted into a text.
cookie = cookie +"; Max-Age=%s" % max_age
The latest patch documents max_age as requiring an int and adds tests
for the addCookie method... so to handly Py3 support the code looks
like this:
cookie = cookie + b"; Max-Age=" + intToBytes(max_age)
-----------
Should this code continue to handle str/int/long ?
---------
Is there a way to deprecate a single argument from a method/function?
Since max_age does not comply with the coding convention, can we
deprecated max_age with support for str/int/log and create a new
maxAge argument which only supports bytes.
Thanks!
This message is based on https://twistedmatrix.com/trac/ticket/5911#comment:14
In twisted/web/http.py we have the addCookie method which has the
'max_age' argument.
In the current code, the max_age is used as just anything which can be
converted into a text.
cookie = cookie +"; Max-Age=%s" % max_age
The latest patch documents max_age as requiring an int and adds tests
for the addCookie method... so to handly Py3 support the code looks
like this:
cookie = cookie + b"; Max-Age=" + intToBytes(max_age)
-----------
Should this code continue to handle str/int/long ?
---------
Is there a way to deprecate a single argument from a method/function?
Since max_age does not comply with the coding convention, can we
deprecated max_age with support for str/int/log and create a new
maxAge argument which only supports bytes.
Thanks!
--
Adi Roiban
Adi Roiban