From 211e40e21191c06a226b23ee0d5d5391fba237ee Mon Sep 17 00:00:00 2001 From: James Turk Date: Tue, 21 Feb 2012 16:25:51 -0500 Subject: [PATCH] s3 storage, stop creating bucket repeatedly --- oyster/storage/s3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oyster/storage/s3.py b/oyster/storage/s3.py index 71e62aa..e08104c 100644 --- a/oyster/storage/s3.py +++ b/oyster/storage/s3.py @@ -8,11 +8,11 @@ class S3Storage(object): def __init__(self, kernel): self.s3conn = boto.connect_s3(settings.AWS_KEY, settings.AWS_SECRET) + self.bucket = self.s3conn.create_bucket(settings.AWS_BUCKET) def put(self, tracked_doc, data, content_type): """ upload the document to S3 """ - bucket = self.s3conn.create_bucket(settings.AWS_BUCKET) - k = boto.s3.key.Key(bucket) + k = boto.s3.key.Key(self.bucket) k.key = tracked_doc['_id'] headers = {'x-amz-acl': 'public-read', 'Content-Type': content_type}