summaryrefslogtreecommitdiff
path: root/Lib/_MozillaCookieJar.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-12-23 21:24:35 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2005-12-23 21:24:35 +0000
commit133caad561f06d724cc56147837c0542ace27948 (patch)
tree541688bf9e902f973ca91ca33aed194bb3959c27 /Lib/_MozillaCookieJar.py
parent30343b65d28002f12f2ed51725aec440e29f1846 (diff)
downloadcpython-133caad561f06d724cc56147837c0542ace27948.tar.gz
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.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/_MozillaCookieJar.py b/Lib/_MozillaCookieJar.py
index 88e8492504..4f2f3754d8 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: