An empty cookiejar evaluates to False, so it needs to be compared to None for the...
authorAram Dulyan <aram00@gmail.com>
Wed, 9 Mar 2011 11:31:13 +0000 (22:31 +1100)
committerAram Dulyan <aram00@gmail.com>
Wed, 9 Mar 2011 11:31:13 +0000 (22:31 +1100)
requests/core.py

index a685e37..252d8b6 100644 (file)
@@ -111,7 +111,7 @@ class Request(object):
 
         _handlers = []
 
-        if self.cookiejar:
+        if self.cookiejar is not None:
             _handlers.append(urllib2.HTTPCookieProcessor(self.cookiejar))
 
         if self.auth:
@@ -189,7 +189,7 @@ class Request(object):
                 opener = self._get_opener()
                 resp = opener(req)
 
-                if self.cookiejar:
+                if self.cookiejar is not None:
                     self.cookiejar.extract_cookies(resp, req)
                     
             except urllib2.HTTPError, why: