diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 1999-02-25 15:59:54 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 1999-02-25 15:59:54 (GMT) |
commit | 547c3f1c13d8f220bd665666cdda8b30f0d40bfa (patch) | |
tree | 3f7aa953c027cdc3f55badad71c0a6cb52366ac8 /Lib | |
parent | bff3ae1f75a8635f107b0ba1acc7bbf1e8379e0d (diff) | |
download | cpython-547c3f1c13d8f220bd665666cdda8b30f0d40bfa.zip cpython-547c3f1c13d8f220bd665666cdda8b30f0d40bfa.tar.gz cpython-547c3f1c13d8f220bd665666cdda8b30f0d40bfa.tar.bz2 |
pleasing the tabnanny
Diffstat (limited to 'Lib')
-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 0b479c0..2b0f2a7 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -70,7 +70,7 @@ def urlretrieve(url, filename=None, reporthook=None): global _urlopener if not _urlopener: _urlopener = FancyURLopener() - return _urlopener.retrieve(url, filename, reporthook) + return _urlopener.retrieve(url, filename, reporthook) def urlcleanup(): if _urlopener: _urlopener.cleanup() @@ -208,7 +208,7 @@ class URLopener: blocknum = 1 if reporthook: if headers.has_key("content-length"): - size = int(headers["Content-Length"]) + size = int(headers["Content-Length"]) reporthook(0, bs, size) block = fp.read(bs) if reporthook: @@ -305,7 +305,7 @@ class URLopener: else: result = method(url, fp, errcode, errmsg, headers) - if result: return result + if result: return result return self.http_error_default( url, fp, errcode, errmsg, headers) @@ -400,14 +400,14 @@ class URLopener: if string.lower(attr) == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = string.upper(value) - (fp, retrlen) = self.ftpcache[key].retrfile(file, type) - if retrlen is not None and retrlen >= 0: - import mimetools, StringIO - headers = mimetools.Message(StringIO.StringIO( - 'Content-Length: %d\n' % retrlen)) - else: - headers = noheaders() - return addinfourl(fp, headers, "ftp:" + url) + (fp, retrlen) = self.ftpcache[key].retrfile(file, type) + if retrlen is not None and retrlen >= 0: + import mimetools, StringIO + headers = mimetools.Message(StringIO.StringIO( + 'Content-Length: %d\n' % retrlen)) + else: + headers = noheaders() + return addinfourl(fp, headers, "ftp:" + url) except ftperrors(), msg: raise IOError, ('ftp error', msg), sys.exc_info()[2] |