Permalink
Browse files

Add version/encryption info to the Completed MPU object.

- Parse the response headers from the complete multipart upload
  command and add information on version_id and encryption.
  • Loading branch information...
1 parent c283da9 commit ac31e30da79b5a15584e2d8e6915e29e61391cba Thomas O'Dowd committed Apr 10, 2012
Showing with 12 additions and 0 deletions.
  1. +8 −0 boto/s3/bucket.py
  2. +4 −0 boto/s3/multipart.py
View
@@ -1427,6 +1427,14 @@ def complete_multipart_upload(self, key_name, upload_id,
resp = CompleteMultiPartUpload(self)
h = handler.XmlHandler(resp, self)
xml.sax.parseString(body, h)
+ # Use a dummy key to parse various response headers
+ # for versioning, encryption info and then explicitly
+ # set the completed MPU object values from key.
+ k = self.key_class(self)
+ k.handle_version_headers(response)
+ k.handle_encryption_headers(response)
+ resp.version_id = k.version_id
+ resp.encrypted = k.encrypted
return resp
else:
raise self.connection.provider.storage_response_error(
View
@@ -35,6 +35,8 @@ class CompleteMultiPartUpload(object):
is contained
* key_name - The name of the new, completed key
* etag - The MD5 hash of the completed, combined upload
+ * version_id - The version_id of the completed upload
+ * encrypted - The value of the encryption header
"""
def __init__(self, bucket=None):
@@ -43,6 +45,8 @@ def __init__(self, bucket=None):
self.bucket_name = None
self.key_name = None
self.etag = None
+ self.version_id = None
+ self.encrypted = None
def __repr__(self):
return '<CompleteMultiPartUpload: %s.%s>' % (self.bucket_name,

0 comments on commit ac31e30

Please sign in to comment.