vavavr00m / boto

Automatically exported from code.google.com/p/boto
1 stars 0 forks source link

upload_part_from_file should return key #566

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is a simple enhancement.

Currently when uploading a multipart object, you can't easily get the etags for 
the uploaded parts without doing get_all_parts which makes another call to 
Amazon. Amazon also recommends keeping track of etags yourself as its the only 
way to guarantee the final objects contents as you can't pre-calculate the 
final etag of a multipart uploaded object.

A simple enhancement is the return the key from upload_part_from_file(). This 
makes the etag etc available for collection by the application.

patch is as simple as the following.

--- ../boto-2.1.1/boto/s3/multipart.py.old      2011-12-05 09:30:08.234265263 
+0900
+++ ../boto-2.1.1/boto/s3/multipart.py  2011-12-05 09:30:18.952309473 +0900
@@ -232,6 +232,7 @@
         key.set_contents_from_file(fp, headers, replace, cb, num_cb, policy,
                                    md5, reduced_redundancy=False,
                                    query_args=query_args)
+        return key

     def complete_upload(self):
         """

Original issue reported on code.google.com by tpod...@gmail.com on 5 Dec 2011 at 12:35