[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/download. Fixes #566167
Alexandru Plugaru
alexandru.plugaru at gmail.com
Mon Mar 14 14:18:05 EDT 2011
Log message for revision 120917:
Fixes #566167
Changed:
U zc.buildout/trunk/src/zc/buildout/download.py
U zc.buildout/trunk/src/zc/buildout/download.txt
-=-
Modified: zc.buildout/trunk/src/zc/buildout/download.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/download.py 2011-03-14 18:18:03 UTC (rev 120916)
+++ zc.buildout/trunk/src/zc/buildout/download.py 2011-03-14 18:18:04 UTC (rev 120917)
@@ -175,16 +175,19 @@
urllib._urlopener = url_opener
handle, tmp_path = tempfile.mkstemp(prefix='buildout-')
try:
- try:
- tmp_path, headers = urllib.urlretrieve(url, tmp_path)
- if not check_md5sum(tmp_path, md5sum):
- raise ChecksumError(
- 'MD5 checksum mismatch downloading %r' % url)
- finally:
- os.close(handle)
- except:
+ tmp_path, headers = urllib.urlretrieve(url, tmp_path)
+ if not check_md5sum(tmp_path, md5sum):
+ raise ChecksumError(
+ 'MD5 checksum mismatch downloading %r' % url)
+ except IOError, e:
os.remove(tmp_path)
+ raise zc.buildout.UserError("Error downloading extends for URL "
+ "%s: %r" % (url, e[1:3]))
+ except Exception, e:
+ os.remove(tmp_path)
raise
+ finally:
+ os.close(handle)
if path:
shutil.move(tmp_path, path)
Modified: zc.buildout/trunk/src/zc/buildout/download.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/download.txt 2011-03-14 18:18:03 UTC (rev 120916)
+++ zc.buildout/trunk/src/zc/buildout/download.txt 2011-03-14 18:18:04 UTC (rev 120917)
@@ -254,6 +254,13 @@
>>> remove(path)
+If the file is completely missing it should notify the user of the error:
+
+>>> download(server_url+'bar.txt')
+Traceback (most recent call last):
+UserError: Error downloading extends for URL http://localhost/bar.txt: (404, 'Not Found')
+>>> ls(cache)
+
Finally, let's see what happens if the download cache to be used doesn't exist
as a directory in the file system yet:
More information about the checkins
mailing list