Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1279)

Unified Diff: boto/storage_uri.py

Issue 8669001: Pull in upstream boto from github at bcb719937de9ac2851e632d62b777352029a6d55 (Closed) Base URL: svn://svn.chromium.org/boto
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « boto/sqs/queue.py ('k') | boto/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « boto/sqs/queue.py ('k') | boto/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698