diff options
author | Mitch.Garnaat <Mitch.Garnaat@604d75c7-a419-0410-a38f-bde1a0bd1dbf> | 2009-12-16 16:22:45 +0000 |
---|---|---|
committer | Mitch.Garnaat <Mitch.Garnaat@604d75c7-a419-0410-a38f-bde1a0bd1dbf> | 2009-12-16 16:22:45 +0000 |
commit | 61dad77d82fe821594cb149abe87215c335b5383 (patch) | |
tree | a54ad287b77155a8a9e1bb425d013c51f71c401a | |
parent | 93ce30cb0a5c02c8d5c0b580789bd822b67fa0b9 (diff) | |
download | boto-61dad77d82fe821594cb149abe87215c335b5383.tar.gz |
Added a convenience method for setting a canned ACL.
-rw-r--r-- | boto/s3/key.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/boto/s3/key.py b/boto/s3/key.py index b8ae5ae9..ada43521 100644 --- a/boto/s3/key.py +++ b/boto/s3/key.py @@ -248,20 +248,15 @@ class Key(object): def set_xml_acl(self, acl_str, headers=None): if self.bucket != None: return self.bucket.set_xml_acl(acl_str, self.name, headers=headers) + + def set_canned_acl(self, acl_str, headers=None): + return self.bucket.set_canned_acl(acl_str, self.name, headers) def make_public(self, headers=None): - if headers: - headers['x-amz-acl'] = 'public-read' - else: - headers={'x-amz-acl': 'public-read'} - - response = self.bucket.connection.make_request('PUT', self.bucket.name, self.name, - headers=headers, query_args='acl') - body = response.read() - if response.status != 200: - raise S3ResponseError(response.status, response.reason, body) + return self.bucket.set_canned_acl('public-read', self.name, headers) - def generate_url(self, expires_in, method='GET', headers=None, query_auth=True, force_http=False): + def generate_url(self, expires_in, method='GET', headers=None, + query_auth=True, force_http=False): """ Generate a URL to access this key. |