X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/6a259b96cff47e1fd64cbfd6f3d1e1d8e8b6486c..6d938c38424fc8aae324f3fcf800de5d615a84fc:/apps/catalogue/tasks.py?ds=sidebyside diff --git a/apps/catalogue/tasks.py b/apps/catalogue/tasks.py index e9b8cf9b..3e230379 100644 --- a/apps/catalogue/tasks.py +++ b/apps/catalogue/tasks.py @@ -9,3 +9,12 @@ def refresh_by_pk(cls, pk): def refresh_instance(instance): refresh_by_pk.delay(type(instance), instance.pk) + +@task +def publishable_error(book): + try: + book.assert_publishable() + except AssertionError, e: + return e + else: + return None