Commits

Malcolm Tredinnick committed ffa1c67

Allow finer-grained control over URL general in S3BotoStorage.

Also fixed an error message when we cannot auto-create S3 buckets so that it explains what is really going wrong.

  • Participants
  • Parent commits 5315fda

Comments (0)

Files changed (1)

File storages/backends/s3boto.py

             if AUTO_CREATE_BUCKET:
                 return self.connection.create_bucket(name)
             raise ImproperlyConfigured, ("Bucket specified by "
-            "AWS_STORAGE_BUCKET_NAME does not exist. Buckets can be "
-            "automatically created by setting AWS_AUTO_CREATE_BUCKET=True")
+            "'%s' does not exist. Buckets can be automatically created "
+            "by setting AWS_AUTO_CREATE_BUCKET=True" % name)
     
     def _clean_name(self, name):
         # Useful for windows' paths
         name = self._clean_name(name)
         return self.bucket.get_key(name).size
     
-    def url(self, name):
+    def url(self, name, expiry=QUERYSTRING_EXPIRE, query_auth=QUERYSTRING_AUTH):
         name = self._clean_name(name)
-        return self.connection.generate_url(QUERYSTRING_EXPIRE, method='GET', \
-                bucket=self.bucket.name, key=name, query_auth=QUERYSTRING_AUTH)
+        return self.connection.generate_url(expiry, method='GET', \
+                bucket=self.bucket.name, key=name, query_auth=query_auth)
 
     def get_available_name(self, name):
         """ Overwrite existing file with the same name. """