From b784fc7cd8cb2a6c2f5da616bfea1963da9137ae Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 21 Jul 2012 16:17:44 -0400 Subject: [PATCH] Fix a silly bug in passing cookiejars to Site objects. * Apparently bool(cookiejar) is False if the cookiejar doesn't contain any cookies, even if it exists. Change `if cookiejar` to `if cookiejar is not None` to get around this. --- earwigbot/wiki/site.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/earwigbot/wiki/site.py b/earwigbot/wiki/site.py index 96bb622..cebb849 100644 --- a/earwigbot/wiki/site.py +++ b/earwigbot/wiki/site.py @@ -101,7 +101,7 @@ class Site(object): based on your config file and the sites database. We accept a bunch of kwargs, but the only ones you really "need" are *base_url* and *script_path*; this is enough to figure out an API url. *login*, a - tuple of (username, password), is highly recommended. *cookiejar will + tuple of (username, password), is highly recommended. *cookiejar* will be used to store cookies, and we'll use a normal CookieJar if none is given. @@ -146,7 +146,7 @@ class Site(object): self._search_config = {} # Set up cookiejar and URL opener for making API queries: - if cookiejar: + if cookiejar is not None: self._cookiejar = cookiejar else: self._cookiejar = CookieJar()