X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/54e4ec4a3aac555f44ea604c12a3955592b5d568..17bd0c21add8a0b41a57f6f531dc0a90bbd0a393:/apps/catalogue/tasks.py?ds=inline diff --git a/apps/catalogue/tasks.py b/apps/catalogue/tasks.py index 5566fe177..e1ff9151a 100755 --- a/apps/catalogue/tasks.py +++ b/apps/catalogue/tasks.py @@ -4,7 +4,8 @@ # from datetime import datetime from celery.task import task - +import catalogue.models +from traceback import print_exc @task def touch_tag(tag): @@ -14,3 +15,13 @@ def touch_tag(tag): } type(tag).objects.filter(pk=tag.pk).update(**update_dict) + + +@task +def index_book(book_id, book_info=None): + try: + return catalogue.models.Book.objects.get(id=book_id).search_index(book_info) + except Exception, e: + print "Exception during index: %s" % e + print_exc() + raise e