Permalink
Browse files

Added a convenience method for setting a canned ACL.

  • Loading branch information...
1 parent 93ce30c commit 61dad77d82fe821594cb149abe87215c335b5383 Mitch.Garnaat committed Dec 16, 2009
Showing with 6 additions and 11 deletions.
  1. +6 −11 boto/s3/key.py
View
@@ -248,20 +248,15 @@ def get_xml_acl(self, headers=None):
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.

0 comments on commit 61dad77

Please sign in to comment.