Re-disable the HTML sanitize for now
[oweals/karmaworld.git] / karmaworld / apps / notes / tasks.py
1 #!/usr/bin/env python
2 # -*- coding:utf8 -*-
3 # Copyright (C) 2012  FinalsClub Foundation
4
5 from celery.task import task
6 from karmaworld.apps.notes.gdrive import convert_with_google_drive
7
8 @task
9 def process_document(note):
10     """ Process a file with Google Drive
11         populates and saves the Note.html, Note.text
12
13         :note: A `karmaworld.apps.notes.models.Note` instance associated, document or pdf file
14         :returns: True on success, else False
15     """
16     print "Processing document: %s -- %s" % (note.id, note.name)
17     try:
18         convert_with_google_drive(note)
19     except Exception, e:
20         print "\terror processing doc: %s -- %s" % (note.id, note.name)
21         return False
22     return True