Malcolm Tredinnick avatar 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.

Comments (0)

Files changed (1)


             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', \
-      , key=name, query_auth=QUERYSTRING_AUTH)
+        return self.connection.generate_url(expiry, method='GET', \
+      , key=name, query_auth=query_auth)
     def get_available_name(self, name):
         """ Overwrite existing file with the same name. """
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.