Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
dachshund 2014-01-06 16:34:17 -05:00
commit 4e75ead4d4

View file

@ -132,10 +132,15 @@ def get_target_filepath(self, source_url):
def open(self, url, data=None):
filename, headers = self.retrieve(url, data=data)
# TUF should always open files in binary mode and remain transparent to the
# software updater. Opening files in text mode slightly alters the
# end-of-line characters and prevents binary files from properly loading on
# Windows.
# http://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
# TODO: like tempfile, ensure file is deleted when closed?
temporary_file = open(filename, 'rb')
# extend temporary_file with info(), getcode(), geturl()
# Extend temporary_file with info(), getcode(), geturl()
# http://docs.python.org/2/library/urllib.html#urllib.urlopen
response = urllib.addinfourl(temporary_file, headers, url, code=200)