mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fix test_cookie after filter() behavior change.
This commit is contained in:
parent
99c0c223e2
commit
0c41e887bd
1 changed files with 2 additions and 2 deletions
|
@ -312,7 +312,7 @@ def _quote(str, LegalChars=_LegalChars):
|
||||||
# the string in doublequotes and precede quote (with a \)
|
# the string in doublequotes and precede quote (with a \)
|
||||||
# special characters.
|
# special characters.
|
||||||
#
|
#
|
||||||
if len(filter(LegalChars.__contains__, str)) == len(str):
|
if all(c in LegalChars for c in str):
|
||||||
return str
|
return str
|
||||||
else:
|
else:
|
||||||
return '"' + _nulljoin( map(_Translator.get, str, str) ) + '"'
|
return '"' + _nulljoin( map(_Translator.get, str, str) ) + '"'
|
||||||
|
@ -442,7 +442,7 @@ class Morsel(dict):
|
||||||
# Second we make sure it only contains legal characters
|
# Second we make sure it only contains legal characters
|
||||||
if key.lower() in self._reserved:
|
if key.lower() in self._reserved:
|
||||||
raise CookieError("Attempt to set a reserved key: %s" % key)
|
raise CookieError("Attempt to set a reserved key: %s" % key)
|
||||||
if len(filter(LegalChars.__contains__, key)) != len(key):
|
if any(c not in LegalChars for c in key):
|
||||||
raise CookieError("Illegal key value: %s" % key)
|
raise CookieError("Illegal key value: %s" % key)
|
||||||
|
|
||||||
# It's a good key, so save it.
|
# It's a good key, so save it.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue