]> granicus.if.org Git - python/commitdiff
Cleanup: the in operator already returns a bool, no need to bool() it again
authorNeal Norwitz <nnorwitz@gmail.com>
Mon, 7 Jun 2004 03:49:50 +0000 (03:49 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Mon, 7 Jun 2004 03:49:50 +0000 (03:49 +0000)
Cleanup: use condition to be consistent with code above
CookieJar is in cookielib

Lib/urllib2.py

index 448e948a73a221f0cd59efac411af652d71fc218..301b5dee78303f558c9f4817e6caee00a97c9162 100644 (file)
@@ -263,8 +263,8 @@ class Request:
         self.unredirected_hdrs[key.capitalize()] = val
 
     def has_header(self, header_name):
-        return bool(header_name in self.headers or
-                    header_name in self.unredirected_hdrs)
+        return (header_name in self.headers or
+                header_name in self.unredirected_hdrs)
 
     def get_header(self, header_name, default=None):
         return self.headers.get(
@@ -295,7 +295,7 @@ class OpenerDirector:
             condition = meth[i+1:]
 
             if condition.startswith("error"):
-                j = meth[i+1:].find("_") + i + 1
+                j = condition.find("_") + i + 1
                 kind = meth[j+1:]
                 try:
                     kind = int(kind)
@@ -1026,7 +1026,7 @@ if hasattr(httplib, 'HTTPS'):
 class HTTPCookieProcessor(BaseHandler):
     def __init__(self, cookiejar=None):
         if cookiejar is None:
-            cookiejar = CookieJar()
+            cookiejar = cookielib.CookieJar()
         self.cookiejar = cookiejar
 
     def http_request(self, request):