diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2005-12-23 21:24:35 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-12-23 21:24:35 (GMT) |
commit | 3e7de59bd2ac22f677f3a053ade22f44785f15f4 (patch) | |
tree | b2f803ac772da9e4be5ff0087b2d783c77ded54e /Lib/_MozillaCookieJar.py | |
parent | b164dafebb6b73eccdf0ced74c23e8896786b456 (diff) | |
download | cpython-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/_MozillaCookieJar.py')
-rw-r--r-- | Lib/_MozillaCookieJar.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/_MozillaCookieJar.py b/Lib/_MozillaCookieJar.py index 88e8492..4f2f375 100644 --- a/Lib/_MozillaCookieJar.py +++ b/Lib/_MozillaCookieJar.py @@ -2,8 +2,8 @@ import re, time, logging -from cookielib import (reraise_unmasked_exceptions, FileCookieJar, Cookie, - MISSING_FILENAME_TEXT) +from cookielib import (reraise_unmasked_exceptions, FileCookieJar, LoadError, + Cookie, MISSING_FILENAME_TEXT) class MozillaCookieJar(FileCookieJar): """ @@ -50,7 +50,7 @@ class MozillaCookieJar(FileCookieJar): magic = f.readline() if not re.search(self.magic_re, magic): f.close() - raise IOError( + raise LoadError( "%s does not look like a Netscape format cookies file" % filename) @@ -106,8 +106,8 @@ class MozillaCookieJar(FileCookieJar): except: reraise_unmasked_exceptions((IOError,)) - raise IOError("invalid Netscape format file %s: %s" % - (filename, line)) + raise LoadError("invalid Netscape format file %s: %s" % + (filename, line)) def save(self, filename=None, ignore_discard=False, ignore_expires=False): if filename is None: |