diff options
author | Georg Brandl <georg@python.org> | 2006-05-08 17:48:01 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-05-08 17:48:01 +0000 |
commit | be17479974cf0316111fb85225cfbdb266facafe (patch) | |
tree | af2ce9148802dd8a1917db281ab491590145061b /Lib/_LWPCookieJar.py | |
parent | 5cc7bdbdb56c81a124005ff5ecfbb6b90a8feccb (diff) | |
download | cpython-be17479974cf0316111fb85225cfbdb266facafe.tar.gz |
Patch #1478993: take advantage of BaseException/Exception split in cookielib
Diffstat (limited to 'Lib/_LWPCookieJar.py')
-rw-r--r-- | Lib/_LWPCookieJar.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Lib/_LWPCookieJar.py b/Lib/_LWPCookieJar.py index 6d5ce185e5..76da942a53 100644 --- a/Lib/_LWPCookieJar.py +++ b/Lib/_LWPCookieJar.py @@ -12,9 +12,10 @@ libwww-perl, I hope. """ import time, re, logging -from cookielib import (reraise_unmasked_exceptions, FileCookieJar, LoadError, - Cookie, MISSING_FILENAME_TEXT, join_header_words, split_header_words, - iso2time, time2isoz) +from cookielib import (_warn_unhandled_exception, FileCookieJar, LoadError, + Cookie, MISSING_FILENAME_TEXT, + join_header_words, split_header_words, + iso2time, time2isoz) def lwp_cookie_str(cookie): """Return string representation of Cookie in an the LWP cookie file format. @@ -92,7 +93,8 @@ class LWPCookieJar(FileCookieJar): def _really_load(self, f, filename, ignore_discard, ignore_expires): magic = f.readline() if not re.search(self.magic_re, magic): - msg = "%s does not seem to contain cookies" % filename + msg = ("%r does not look like a Set-Cookie3 (LWP) format " + "file" % filename) raise LoadError(msg) now = time.time() @@ -159,6 +161,10 @@ class LWPCookieJar(FileCookieJar): if not ignore_expires and c.is_expired(now): continue self.set_cookie(c) - except: - reraise_unmasked_exceptions((IOError,)) - raise LoadError("invalid Set-Cookie3 format file %s" % filename) + + except IOError: + raise + except Exception: + _warn_unhandled_exception() + raise LoadError("invalid Set-Cookie3 format file %r: %r" % + (filename, line)) |