summaryrefslogtreecommitdiffstats
path: root/Lib/_LWPCookieJar.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-12-23 21:24:35 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-12-23 21:24:35 (GMT)
commit3e7de59bd2ac22f677f3a053ade22f44785f15f4 (patch)
treeb2f803ac772da9e4be5ff0087b2d783c77ded54e /Lib/_LWPCookieJar.py
parentb164dafebb6b73eccdf0ced74c23e8896786b456 (diff)
downloadcpython-3e7de59bd2ac22f677f3a053ade22f44785f15f4.zip
cpython-3e7de59bd2ac22f677f3a053ade22f44785f15f4.tar.gz
cpython-3e7de59bd2ac22f677f3a053ade22f44785f15f4.tar.bz2
Fix SF #1117398, cookielib LWPCookieJar and MozillaCookieJar exceptions
cookielib.LWPCookieJar and .MozillaCookieJar are documented to raise cookielib.LoadError on attempt to load an invalid cookies file, but raise IOError instead. Compromise by having LoadError subclass IOError.
Diffstat (limited to 'Lib/_LWPCookieJar.py')
-rw-r--r--Lib/_LWPCookieJar.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/_LWPCookieJar.py b/Lib/_LWPCookieJar.py
index 25a2528..6d5ce18 100644
--- a/Lib/_LWPCookieJar.py
+++ b/Lib/_LWPCookieJar.py
@@ -12,8 +12,8 @@ libwww-perl, I hope.
"""
import time, re, logging
-from cookielib import (reraise_unmasked_exceptions, FileCookieJar, Cookie,
- MISSING_FILENAME_TEXT, join_header_words, split_header_words,
+from cookielib import (reraise_unmasked_exceptions, FileCookieJar, LoadError,
+ Cookie, MISSING_FILENAME_TEXT, join_header_words, split_header_words,
iso2time, time2isoz)
def lwp_cookie_str(cookie):
@@ -93,7 +93,7 @@ class LWPCookieJar(FileCookieJar):
magic = f.readline()
if not re.search(self.magic_re, magic):
msg = "%s does not seem to contain cookies" % filename
- raise IOError(msg)
+ raise LoadError(msg)
now = time.time()
@@ -161,4 +161,4 @@ class LWPCookieJar(FileCookieJar):
self.set_cookie(c)
except:
reraise_unmasked_exceptions((IOError,))
- raise IOError("invalid Set-Cookie3 format file %s" % filename)
+ raise LoadError("invalid Set-Cookie3 format file %s" % filename)