From e6c9cd6a069208a5038fddcfbdf1754167318b7a Mon Sep 17 00:00:00 2001 From: James Turk Date: Tue, 4 Oct 2011 12:46:32 -0400 Subject: [PATCH] pass a string as filedata in ExternalStoreTask --- oyster/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oyster/tasks.py b/oyster/tasks.py index ad88eb2..083653d 100644 --- a/oyster/tasks.py +++ b/oyster/tasks.py @@ -67,7 +67,7 @@ class ExternalStoreTask(Task): def run(self, doc_id): # get the document doc = self.client.db.tracked.find_one({'_id': ObjectId(doc_id)}) - filedata = self.client.get_version(doc['url']) + filedata = self.client.get_version(doc['url']).read() # put the document into the data store result = self.upload_document(doc_id, filedata, doc['metadata']) @@ -92,7 +92,7 @@ class S3StoreTask(ExternalStoreTask): bucket = self.s3conn.create_bucket(settings.AWS_BUCKET) k = self.boto.s3.Key(bucket) k.key = doc_id - k.set_contents_from_string(filedata.read()) + k.set_contents_from_string(filedata) k.set_acl('public-read') url = 'http://%s.s3.amazonaws.com/%s' % (settings.AWS_BUCKET, doc_id)