David Larlet avatar David Larlet committed 684e976

Exposes the query_auth argument to boto's generate_url via new a setting AWS_QUERYSTRING_AUTH (default True for backwards compatibility). Thanks James from @incuna for the patch.

Comments (0)

Files changed (1)

backends/s3boto.py

 HEADERS         = 'AWS_HEADERS'
 BUCKET_NAME     = 'AWS_STORAGE_BUCKET_NAME'
 DEFAULT_ACL     = 'AWS_DEFAULT_ACL'
+QUERYSTRING_AUTH = 'AWS_QUERYSTRING_AUTH'
 QUERYSTRING_EXPIRE = 'AWS_QUERYSTRING_EXPIRE'
 
 BUCKET_PREFIX     = getattr(settings, BUCKET_NAME, {})
 HEADERS           = getattr(settings, HEADERS, {})
 DEFAULT_ACL       = getattr(settings, DEFAULT_ACL, 'public-read')
+QUERYSTRING_AUTH  = getattr(settings, QUERYSTRING_AUTH, True)
 QUERYSTRING_EXPIRE= getattr(settings, QUERYSTRING_EXPIRE, 3600)
 
 
         return self.bucket.get_key(name).size
     
     def url(self, name):
-        return self.bucket.get_key(name).generate_url(QUERYSTRING_EXPIRE, method='GET')
+        return self.bucket.get_key(name).generate_url(QUERYSTRING_EXPIRE, method='GET', query_auth=QUERYSTRING_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 ProjectModifiedEvent.java.
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.