From 8c589c1ccd1efbbb9d19bc181a1969c439fa892a Mon Sep 17 00:00:00 2001 From: James Turk Date: Tue, 6 Mar 2012 18:35:43 -0500 Subject: [PATCH] add support for AWS_PREFIX --- oyster/storage/s3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oyster/storage/s3.py b/oyster/storage/s3.py index e08104c..f5075e4 100644 --- a/oyster/storage/s3.py +++ b/oyster/storage/s3.py @@ -13,14 +13,14 @@ class S3Storage(object): def put(self, tracked_doc, data, content_type): """ upload the document to S3 """ k = boto.s3.key.Key(self.bucket) - k.key = tracked_doc['_id'] + key_name = getattr(settings, AWS_PREFIX, '') + tracked_doc['_id'] + k.key = key_name headers = {'x-amz-acl': 'public-read', 'Content-Type': content_type} k.set_contents_from_string(data, headers=headers) # can also set metadata if we want, useful? - url = 'http://%s.s3.amazonaws.com/%s' % (settings.AWS_BUCKET, - tracked_doc['_id']) + url = 'http://%s.s3.amazonaws.com/%s' % (settings.AWS_BUCKET, key_name) return url def get(self, id):