diff options
author | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
commit | ce36ad8a467d914eb5c91f33835b9eaea18ee93b (patch) | |
tree | 05bf654f3359e20b455dc300bd860bba5d291c8d /Lib/urllib.py | |
parent | 8b3febef2f96c35e9aad9db2ef499db040fdefae (diff) | |
download | cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.zip cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.gz cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.bz2 |
Raise statement normalization in Lib/.
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index bbcd00e2..6bf89ee 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -196,12 +196,12 @@ class URLopener: def open_unknown(self, fullurl, data=None): """Overridable interface to open unknown URL type.""" type, url = splittype(fullurl) - raise IOError, ('url error', 'unknown url type', type) + raise IOError('url error', 'unknown url type', type) def open_unknown_proxy(self, proxy, fullurl, data=None): """Overridable interface to open unknown URL type.""" type, url = splittype(fullurl) - raise IOError, ('url error', 'invalid proxy for %s' % type, proxy) + raise IOError('url error', 'invalid proxy for %s' % type, proxy) # External interface def retrieve(self, url, filename=None, reporthook=None, data=None): @@ -308,7 +308,7 @@ class URLopener: host = realhost #print "proxy via http:", host, selector - if not host: raise IOError, ('http error', 'no host given') + if not host: raise IOError('http error', 'no host given') if proxy_passwd: import base64 @@ -380,7 +380,7 @@ class URLopener: """Default error handler: close the connection and raise IOError.""" void = fp.read() fp.close() - raise IOError, ('http error', errcode, errmsg, headers) + raise IOError('http error', errcode, errmsg, headers) if hasattr(socket, "ssl"): def _https_connection(self, host): @@ -395,7 +395,7 @@ class URLopener: def open_file(self, url): """Use local file or FTP depending on form of URL.""" if not isinstance(url, str): - raise IOError, ('file error', 'proxy support for file protocol currently not implemented') + raise IOError('file error', 'proxy support for file protocol currently not implemented') if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/': return self.open_ftp(url) else: @@ -441,16 +441,16 @@ class URLopener: urlfile = 'file://' + file return addinfourl(open(localname, 'rb'), headers, urlfile) - raise IOError, ('local file error', 'not on local host') + raise IOError('local file error', 'not on local host') def open_ftp(self, url): """Use FTP protocol.""" if not isinstance(url, str): - raise IOError, ('ftp error', 'proxy support for ftp protocol currently not implemented') + raise IOError('ftp error', 'proxy support for ftp protocol currently not implemented') import mimetypes, mimetools from io import StringIO host, path = splithost(url) - if not host: raise IOError, ('ftp error', 'no host given') + if not host: raise IOError('ftp error', 'no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) @@ -505,7 +505,7 @@ class URLopener: def open_data(self, url, data=None): """Use "data" URL.""" if not isinstance(url, str): - raise IOError, ('data error', 'proxy support for data protocol currently not implemented') + raise IOError('data error', 'proxy support for data protocol currently not implemented') # ignore POSTed data # # syntax of data URLs: @@ -518,7 +518,7 @@ class URLopener: try: [type, data] = url.split(',', 1) except ValueError: - raise IOError, ('data error', 'bad data URL') + raise IOError('data error', 'bad data URL') if not type: type = 'text/plain;charset=US-ASCII' semi = type.rfind(';') @@ -1032,7 +1032,7 @@ def splitnport(host, defport=-1): if match: host, port = match.group(1, 2) try: - if not port: raise ValueError, "no digits" + if not port: raise ValueError("no digits") nport = int(port) except ValueError: nport = None |