[Python-checkins] r83398 - in python/branches/py3k: Lib/http/cookies.py Lib/test/test_http_cookies.py Misc/NEWS
Ezio Melotti
ezio.melotti at gmail.com
Wed Aug 4 07:51:23 CEST 2010
Hi,
On 01/08/2010 12.06, georg.brandl wrote:
> Author: georg.brandl
> Date: Sun Aug 1 11:06:34 2010
> New Revision: 83398
>
> Log:
> #8826: the "expires" attribute value is a date string with spaces, but apparently not all user-agents put it in quotes. Handle that as a special case.
>
> Modified:
> python/branches/py3k/Lib/http/cookies.py
> python/branches/py3k/Lib/test/test_http_cookies.py
> python/branches/py3k/Misc/NEWS
>
> Modified: python/branches/py3k/Lib/http/cookies.py
> ==============================================================================
> --- python/branches/py3k/Lib/http/cookies.py (original)
> +++ python/branches/py3k/Lib/http/cookies.py Sun Aug 1 11:06:34 2010
> @@ -434,6 +434,8 @@
> (?P<val> # Start of group 'val'
> "(?:[^\\"]|\\.)*" # Any doublequoted string
> | # or
> + \w{3},\s[\w\d-]{9,11}\s[\d:]{8}\sGM
Isn't the \d in [\w\d-] redundant?
> T # Special case for "expires" attr
> + | # or
> """ + _LegalCharsPatt + r"""* # Any word or empty string
> ) # End of group 'val'
> \s*;? # Probably ending in a semi-colon
>
> Modified: python/branches/py3k/Lib/test/test_http_cookies.py
> ==============================================================================
> --- python/branches/py3k/Lib/test/test_http_cookies.py (original)
> +++ python/branches/py3k/Lib/test/test_http_cookies.py Sun Aug 1 11:06:34 2010
> @@ -76,6 +76,16 @@
> # can't test exact output, it always depends on current date/time
> self.assertTrue(C.output().endswith('GMT'))
>
> + # loading 'expires'
> + C = cookies.SimpleCookie()
> + C.load('Customer="W"; expires=Wed, 01-Jan-2010 00:00:00 GMT')
> + self.assertEqual(C['Customer']['expires'],
> + 'Wed, 01-Jan-2010 00:00:00 GMT')
> + C = cookies.SimpleCookie()
> + C.load('Customer="W"; expires=Wed, 01-Jan-98 00:00:00 GMT')
> + self.assertEqual(C['Customer']['expires'],
> + 'Wed, 01-Jan-98 00:00:00 GMT')
> +
> # 'max-age'
> C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
> C['Customer']['max-age'] = 10
>
> Modified: python/branches/py3k/Misc/NEWS
> ==============================================================================
> --- python/branches/py3k/Misc/NEWS (original)
> +++ python/branches/py3k/Misc/NEWS Sun Aug 1 11:06:34 2010
> @@ -15,6 +15,8 @@
> Library
> -------
>
> +- Issue #8826: Properly load old-style "expires" attribute in http.cookies.
> +
> - Issue #1690103: Fix initial namespace for code run with trace.main().
>
> - Issue #7395: Fix tracebacks in pstats interactive browser.
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>
Best Regards,
Ezio Melotti
More information about the Python-checkins
mailing list