From: Bryan Date: Tue, 17 Dec 2013 21:36:48 +0000 (-0500) Subject: places ENML to XML mimetype conversion in the wrong place, this should work for celery. X-Git-Tag: release-20150131~386^2~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=faeb529765b0a2db15bb7543518ed9e32a62838a;p=oweals%2Fkarmaworld.git places ENML to XML mimetype conversion in the wrong place, this should work for celery. --- 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