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