Commits

Wes Winham  committed 06da78f

Added upstream patch for only setting bucket ACL if the bucket is being created

  • Participants
  • Parent commits b635b61

Comments (0)

Files changed (1)

File storages/backends/s3boto.py

     def bucket(self):
         if not self._bucket:
             self._bucket = self._get_or_create_bucket(self._bucket_name)
-            try:
-                self._bucket.set_acl(self.bucket_acl)
-            except S3ResponseError:
-                # Sometimes concurrent connections attempting to modify an ACL
-                # causes a 409 conflict error.
-                if settings.DEBUG:
-                    raise
         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)
+                try:
+                    self._bucket.set_acl(self.bucket_acl)
+                except S3ResponseError:
+                    # Sometimes concurrent connections attempting to modify an ACL
+                    # causes a 409 conflict error.
+                    if settings.DEBUG:
+                        raise
+                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")