From 5d1ebb1cecdd878ec93ea6010896624929a2528e Mon Sep 17 00:00:00 2001 From: Seth Woodworth Date: Thu, 17 Jan 2013 15:10:27 -0500 Subject: [PATCH] importing celery tasks from djkarma --- karmaworld/apps/notes/tasks.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 karmaworld/apps/notes/tasks.py 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 -- 2.25.1