]> granicus.if.org Git - python/commitdiff
Fix test_cookie after filter() behavior change.
authorGuido van Rossum <guido@python.org>
Tue, 3 Jul 2007 16:46:40 +0000 (16:46 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 3 Jul 2007 16:46:40 +0000 (16:46 +0000)
Lib/Cookie.py

index 0cd32445e5fb2d5b4f0b965b2d5c5f2fbe2a6392..52a766da355d973cd5e4dafc916755e3968d7951 100644 (file)
@@ -312,7 +312,7 @@ def _quote(str, LegalChars=_LegalChars):
     # the string in doublequotes and precede quote (with a \)
     # special characters.
     #
-    if len(filter(LegalChars.__contains__, str)) == len(str):
+    if all(c in LegalChars for c in str):
         return str
     else:
         return '"' + _nulljoin( map(_Translator.get, str, str) ) + '"'
@@ -442,7 +442,7 @@ class Morsel(dict):
         # Second we make sure it only contains legal characters
         if key.lower() in self._reserved:
             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)
 
         # It's a good key, so save it.