Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Commit

Permalink
Try making a new S3 connection every time.
Browse files Browse the repository at this point in the history
  • Loading branch information
spladug committed May 10, 2012
1 parent 4264329 commit 87d871c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postcards/lib/utils.py
Expand Up @@ -13,15 +13,15 @@
from postcards.models import db, Postcard
from postcards.lib.queue import processed_asynchronously

s3 = S3Connection(app.config['S3_ACCESS_KEY'], app.config['S3_SECRET_KEY'])
bucket = s3.get_bucket(app.config['S3_BUCKET'], validate=False)
DEFAULT_DATE = datetime.date(2010, 01, 01)
CHUNK_SIZE = 28

def s3_url_from_filename(filename):
return 'http://' + app.config['S3_BUCKET'] + '.s3.amazonaws.com/' + filename

def upload_to_s3(filename, data, content_type):
s3 = S3Connection(app.config['S3_ACCESS_KEY'], app.config['S3_SECRET_KEY'])
bucket = s3.get_bucket(app.config['S3_BUCKET'], validate=False)
key = bucket.new_key(filename)
key.set_contents_from_string(
data,
Expand Down

0 comments on commit 87d871c

Please sign in to comment.