David Larlet avatar David Larlet committed a26c3c7

Fix a couple of bugs spoted by Ariel in S3 storages

Comments (0)

Files changed (2)

backends/S3BotoStorage.py

 
 ACCESS_KEY_NAME = 'AWS_ACCESS_KEY_ID'
 SECRET_KEY_NAME = 'AWS_SECRET_ACCESS_KEY'
-AWS_HEADERS = 'AWS_HEADERS'
+AWS_HEADERS     = 'AWS_HEADERS'
+AWS_BUCKET_NAME = 'AWS_STORAGE_BUCKET_NAME'
+
+AWS_BUCKET_PREFIX = getattr(settings, AWS_BUCKET_NAME, {})
 
 try:
     from boto.s3.connection import S3Connection
 class S3BotoStorage(Storage):
     """Amazon Simple Storage Service using Boto"""
     
-    def __init__(self, bucket="root", bucketprefix=settings.AWS_BUCKET_PREFIX, access_key=None, secret_key=None, acl='public-read'):
+    def __init__(self, bucket="root", bucketprefix=AWS_BUCKET_PREFIX, access_key=None, secret_key=None, acl='public-read'):
         self.acl = acl
         
         if not access_key and not secret_key:

backends/S3Storage.py

             headers = {'Range': 'bytes=%s-%s' % (start_range, end_range)}
         response = self.connection.get(self.bucket, name, headers)
         headers = response.http_response.msg
-        return response.object.data, headers['etag'], headers.get('content-range', None)
+        return response.object.data, headers.get('etag', None), headers.get('content-range', None)
         
     def _save(self, name, content):
         content.open()
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.