From: Seth Woodworth Date: Wed, 26 Jun 2013 20:35:10 +0000 (+0000) Subject: Merge branch 'ppt-gdrive' of https://github.com/FinalsClub/karmaworld into ppt-gdrive X-Git-Tag: release-20150131~407 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5d63fe06eced72737f9f6724a652f2fa731c88bc;p=oweals%2Fkarmaworld.git Merge branch 'ppt-gdrive' of https://github.com/FinalsClub/karmaworld into ppt-gdrive Conflicts: karmaworld/apps/notes/gdrive.py --- 5d63fe06eced72737f9f6724a652f2fa731c88bc diff --cc karmaworld/apps/notes/gdrive.py index 1207201,437300c..d7bacb9 --- a/karmaworld/apps/notes/gdrive.py +++ b/karmaworld/apps/notes/gdrive.py @@@ -169,16 -161,25 +170,31 @@@ def convert_with_google_drive(note) if extension.lower() == '.pdf': new_note.file_type = 'pdf' + elif extension.lower() in ['.ppt', '.pptx']: + print "try to save ppt" + now = datetime.datetime.utcnow() + # create a folder path to store the ppt > pdf file with year and month folders + _path = os.path.join(settings.MEDIA_ROOT, 'ppt_pdf/%s/%s' % (now.year, now.month), filename) + try: + # If those folders don't exist, create them + os.makedirs(os.path.realpath(os.path.dirname(_path))) + + _writer = BufferedWriter(FileIO(_path, "w")) + _writer.write(content_dict['pdf']) + _writer.close() + + + new_note.pdf_file = os.path.join(_path, filename) # set the .odt as the download from google link - new_note.gdrive_url = file_dict[u'exportLinks']['application/vnd.oasis.opendocument.text'] - new_note.html = content_dict['html'] + if extension.lower() in ['.ppt', '.pptx']: + print "is ppt" + new_note.pdf_file = File(content_dict['pdf']) + else: + # PPT files do not have this export ability + new_note.gdrive_url = file_dict[u'exportLinks']['application/vnd.oasis.opendocument.text'] + new_note.html = content_dict['html'] + new_note.text = content_dict['text'] # before we save new html, sanitize a tags in note.html