X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/f73ecfb6b870b18ed88303ff71a06da55001274b..d7ef322bd562485405be95d8812d4ad79ac458fb:/apps/catalogue/views.py?ds=inline diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 72cf63d3..6fb5f60b 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -27,6 +27,7 @@ from catalogue import forms from catalogue import helpers from catalogue.helpers import active_tab from catalogue.models import Book, Chunk, BookPublishRecord, ChunkPublishRecord +from catalogue.tasks import publishable_error from catalogue import xml_tools # @@ -240,20 +241,14 @@ def book(request, slug): form = forms.ReadonlyBookForm(instance=book) editable = False - - try: - book.assert_publishable() - except AssertionError, e: - publishable = False - publishable_error = e - else: - publishable = True - publishable_error = None + task = publishable_error.delay(book) + publish_error = task.wait() + publishable = publish_error is None return direct_to_template(request, "catalogue/book_detail.html", extra_context={ "book": book, "publishable": publishable, - "publishable_error": publishable_error, + "publishable_error": publish_error, "form": form, "editable": editable, })