Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bubbling up md5 and upload_id for use in manifests.

  • Loading branch information...
commit 7d2f4dd209085c2d9937b7ef3aa80f69a985bdd0 1 parent 81765cc
@reinhillmann reinhillmann authored
Showing with 21 additions and 3 deletions.
  1. +16 −0 boto/gs/resumable_upload_handler.py
  2. +5 −3 boto/storage_uri.py
View
16 boto/gs/resumable_upload_handler.py
@@ -163,6 +163,22 @@ def get_tracker_uri(self):
"""
return self.tracker_uri
+ def get_upload_id(self):
+ """
+ Returns the upload ID for the resumable upload, or None if the upload
+ has not yet started.
+ """
+ # We extract the upload_id from the tracker uri. We could retrieve the
+ # upload_id from the headers in the response but this only works for
+ # the case where we get the tracker uri from the service. In the case
+ # where we get the tracker from the tracking file we need to do this
+ # logic anyway.
+ delim = '?upload_id='
+ if self.tracker_uri and delim in self.tracker_uri:
+ return uri[uri.index(delim) + len(delim):]
+ else:
+ return None
+
def _remove_tracker_file(self):
if (self.tracker_file_name and
os.path.exists(self.tracker_file_name)):
View
8 boto/storage_uri.py
@@ -304,13 +304,15 @@ def _update_from_key(self, key):
self._update_from_values(
getattr(key, 'version_id', None),
getattr(key, 'generation', None),
- getattr(key, 'is_latest', None))
+ getattr(key, 'is_latest', None),
+ getattr(key, 'md5', None))
- def _update_from_values(self, version_id, generation, is_latest):
+ def _update_from_values(self, version_id, generation, is_latest, md5):
self.version_id = version_id
self.generation = generation
self.is_latest = is_latest
self._build_uri_strings()
+ self.md5 = md5
def get_key(self, validate=False, headers=None, version_id=None):
self._check_object_uri('get_key')
@@ -652,7 +654,7 @@ def set_contents_from_file(self, fp, headers=None, replace=True, cb=None,
rewind=rewind, res_upload_handler=res_upload_handler)
if res_upload_handler:
self._update_from_values(None, res_upload_handler.generation,
- None)
+ None, md5)
else:
self._warn_about_args('set_contents_from_file',
res_upload_handler=res_upload_handler)
Please sign in to comment.
Something went wrong with that request. Please try again.