Commits

Wes Winham committed 796ac3c

Refs bitbucket issue #45. Made _get_or_create_bucket a lazy call

Comments (0)

Files changed (1)

storages/backends/s3boto.py

             access_key, secret_key = self._get_access_keys()
 
         self.connection = S3Connection(access_key, secret_key)
-        self.bucket = self._get_or_create_bucket(bucket)
-        self.bucket.set_acl(self.bucket_acl)
+        self._bucket_name = bucket
+        self._bucket = None
+
+    @property
+    def bucket(self):
+        if not 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):
         access_key = ACCESS_KEY_NAME