From: Seth Woodworth Date: Thu, 17 Jan 2013 20:10:27 +0000 (-0500) Subject: importing celery tasks from djkarma X-Git-Tag: release-20150131~557^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5d1ebb1cecdd878ec93ea6010896624929a2528e;p=oweals%2Fkarmaworld.git importing celery tasks from djkarma --- diff --git a/karmaworld/apps/notes/tasks.py b/karmaworld/apps/notes/tasks.py new file mode 100644 index 0000000..d27e8e6 --- /dev/null +++ b/karmaworld/apps/notes/tasks.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# -*- coding:utf8 -*- +# Copyright (C) 2012 FinalsClub Foundation + +from celery.task import task +from karmaworld.apps.notes.gdrive import convert_with_google_drive + +@task +def process_document(note): + """ Process a file with Google Drive + populates and saves the Note.html, Note.text + + :note: A `karmaworld.apps.notes.models.Note` instance associated, document or pdf file + :returns: True on success, else False + """ + print "Processing document: %s -- %s" % (note.id, note.name) + try: + convert_with_google_drive(note) + except Exception, e: + print "\terror processing doc: %s -- %s" % (note.id, note.name) + return False + return True