Skip to content

Commit

Permalink
Fixed preserve_acl param and added additional metadata param. Closes #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
garnaat committed Dec 9, 2011
1 parent 5e32df2 commit e9df553
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions s3_copy_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ def copy_object(src_bucket_name,
src_key_name,
dst_bucket_name,
dst_key_name,
preserve_metadata=True):
metadata=None,
preserve_acl=True):
"""
Copy an existing object to another location.
src_bucket_name Bucket containing the existing object.
src_key_name Name of the existing object.
dst_bucket_name Bucket to which the object is being copied.
dst_key_name The name of the new object.
metadata A dict containing new metadata that you want
to associate with this object. If this is None
the metadata of the original object will be
copied to the new object.
preserve_acl If True, the ACL from the original object
will be copied to the new object. If False
the new object will have the default ACL.
Expand All @@ -23,7 +28,8 @@ def copy_object(src_bucket_name,
key = bucket.lookup(src_key_name)

# Copy the key back on to itself, with new metadata
return key.copy(dst_bucket_name, dst_key_name, preserve_acl=preserve_acl)
return key.copy(dst_bucket_name, dst_key_name,
metadata=metadata, preserve_acl=preserve_acl)



0 comments on commit e9df553

Please sign in to comment.