[Python-3000-checkins] r56164 - python/branches/py3k-struni/Lib/Cookie.py

guido.van.rossum python-3000-checkins at python.org
Tue Jul 3 18:46:40 CEST 2007


Author: guido.van.rossum
Date: Tue Jul  3 18:46:40 2007
New Revision: 56164

Modified:
   python/branches/py3k-struni/Lib/Cookie.py
Log:
Fix test_cookie after filter() behavior change.


Modified: python/branches/py3k-struni/Lib/Cookie.py
==============================================================================
--- python/branches/py3k-struni/Lib/Cookie.py	(original)
+++ python/branches/py3k-struni/Lib/Cookie.py	Tue Jul  3 18:46:40 2007
@@ -312,7 +312,7 @@
     # 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 @@
         # 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.


More information about the Python-3000-checkins mailing list