Olly Smith committed ae2572e

s3boto: only set a bucket's ACL if it's being automatically created.

Comments (0)

Files changed (1)


                        location=LOCATION, file_name_charset=FILE_NAME_CHARSET):
         self.bucket_acl = bucket_acl
         self.bucket_name = bucket
-        self._bucket = None
         self.acl = acl
         self.headers = headers
         self.gzip = gzip
     def bucket(self):
-        if self._bucket is None:
+        if not hasattr(self, '_bucket'):
             self._bucket = self._get_or_create_bucket(self.bucket_name)
-            self._bucket.set_acl(self.bucket_acl)
         return self._bucket
     def _get_access_keys(self):
             return self.connection.get_bucket(name)
         except S3ResponseError, e:
             if AUTO_CREATE_BUCKET:
-                return self.connection.create_bucket(name)
+                bucket = self.connection.create_bucket(name)
+                bucket.set_acl(self.bucket_acl)
+                return bucket
             raise ImproperlyConfigured, ("Bucket specified by "
             "AWS_STORAGE_BUCKET_NAME does not exist. Buckets can be "
             "automatically created by setting AWS_AUTO_CREATE_BUCKET=True")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.