From faeb529765b0a2db15bb7543518ed9e32a62838a Mon Sep 17 00:00:00 2001 From: Bryan Date: Tue, 17 Dec 2013 16:36:48 -0500 Subject: [PATCH] places ENML to XML mimetype conversion in the wrong place, this should work for celery. --- karmaworld/apps/notes/gdrive.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/karmaworld/apps/notes/gdrive.py b/karmaworld/apps/notes/gdrive.py index 8b1ddab..5a426ba 100644 --- a/karmaworld/apps/notes/gdrive.py +++ b/karmaworld/apps/notes/gdrive.py @@ -234,14 +234,17 @@ def convert_raw_document(raw_document): #filename, extension = os.path.splitext(raw_document.fp_file.path) filename = raw_document.name print "this is the mimetype of the document to check:" - print raw_document.mimetype + mimetype = raw_document.mimetype + print mimetype print "" - if raw_document.mimetype == None: + if mimetype == 'text/enml': mimetype = 'text/xml' + + if mimetype == None: media = MediaInMemoryUpload(fp_file.read(), chunksize=1024*1024, resumable=True) else: - media = MediaInMemoryUpload(fp_file.read(), mimetype=raw_document.mimetype, + media = MediaInMemoryUpload(fp_file.read(), mimetype=mimetype, chunksize=1024*1024, resumable=True) auth = DriveAuth.objects.filter(email=GOOGLE_USER).all()[0] @@ -251,8 +254,8 @@ def convert_raw_document(raw_document): service, http = build_api_service(creds) # prepare the upload - file_dict = upload_to_gdrive(service, media, filename, mimetype=raw_document.mimetype) - content_dict = download_from_gdrive(file_dict, http, mimetype=raw_document.mimetype) + file_dict = upload_to_gdrive(service, media, filename, mimetype=mimetype) + content_dict = download_from_gdrive(file_dict, http, mimetype=mimetype) # this should have already happened, lets see why it hasn't raw_document.is_processed = True -- 2.25.1