Index: boto/storage_uri.py |
diff --git a/boto/storage_uri.py b/boto/storage_uri.py |
index 96b8ecacd2393c11d57760e7ca5d966a815bc163..e0a6bef37b39e9b96f0aa868a7e962cd0c71ee54 100755 |
--- a/boto/storage_uri.py |
+++ b/boto/storage_uri.py |
@@ -223,6 +223,7 @@ class BucketStorageUri(StorageUri): |
self.debug) |
def get_acl(self, validate=True, headers=None, version_id=None): |
+ """returns a bucket's acl""" |
if not self.bucket_name: |
raise InvalidUriError('get_acl on bucket-less URI (%s)' % self.uri) |
bucket = self.get_bucket(validate, headers) |
@@ -232,6 +233,17 @@ class BucketStorageUri(StorageUri): |
self.check_response(acl, 'acl', self.uri) |
return acl |
+ def get_def_acl(self, validate=True, headers=None): |
+ """returns a bucket's default object acl""" |
+ if not self.bucket_name: |
+ raise InvalidUriError('get_acl on bucket-less URI (%s)' % self.uri) |
+ bucket = self.get_bucket(validate, headers) |
+ # This works for both bucket- and object- level ACLs (former passes |
+ # key_name=None): |
+ acl = bucket.get_def_acl(self.object_name, headers) |
+ self.check_response(acl, 'acl', self.uri) |
+ return acl |
+ |
def get_location(self, validate=True, headers=None): |
if not self.bucket_name: |
raise InvalidUriError('get_location on bucket-less URI (%s)' % |
@@ -344,14 +356,25 @@ class BucketStorageUri(StorageUri): |
def set_acl(self, acl_or_str, key_name='', validate=True, headers=None, |
version_id=None): |
+ """sets or updates a bucket's acl""" |
if not self.bucket_name: |
raise InvalidUriError('set_acl on bucket-less URI (%s)' % |
self.uri) |
self.get_bucket(validate, headers).set_acl(acl_or_str, key_name, |
headers, version_id) |
+ def set_def_acl(self, acl_or_str, key_name='', validate=True, headers=None, |
+ version_id=None): |
+ """sets or updates a bucket's default object acl""" |
+ if not self.bucket_name: |
+ raise InvalidUriError('set_acl on bucket-less URI (%s)' % |
+ self.uri) |
+ self.get_bucket(validate, headers).set_def_acl(acl_or_str, key_name, |
+ headers) |
+ |
def set_canned_acl(self, acl_str, validate=True, headers=None, |
version_id=None): |
+ """sets or updates a bucket's acl to a predefined (canned) value""" |
if not self.object_name: |
raise InvalidUriError('set_canned_acl on object-less URI (%s)' % |
self.uri) |
@@ -359,6 +382,17 @@ class BucketStorageUri(StorageUri): |
self.check_response(key, 'key', self.uri) |
key.set_canned_acl(acl_str, headers, version_id) |
+ def set_def_canned_acl(self, acl_str, validate=True, headers=None, |
+ version_id=None): |
+ """sets or updates a bucket's default object acl to a predefined |
+ (canned) value""" |
+ if not self.object_name: |
+ raise InvalidUriError('set_canned_acl on object-less URI (%s)' % |
+ self.uri) |
+ key = self.get_key(validate, headers) |
+ self.check_response(key, 'key', self.uri) |
+ key.set_def_canned_acl(acl_str, headers, version_id) |
+ |
def set_subresource(self, subresource, value, validate=True, headers=None, |
version_id=None): |
if not self.bucket_name: |