From: Radek Czajka Date: Tue, 18 Oct 2011 09:20:03 +0000 (+0200) Subject: move xml check to celery, X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/add48c78bc4b08dfda50b0c0ccb6be188c7d56f4?ds=inline move xml check to celery, typo fix --- 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 diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 72cf63d3..b6e4c400 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,6 +241,9 @@ def book(request, slug): form = forms.ReadonlyBookForm(instance=book) editable = False + task = publishable_error.delay(book) + publish_error = t.wait() + publishable = publish_error is None try: book.assert_publishable() @@ -253,7 +257,7 @@ def book(request, slug): 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, }) diff --git a/redakcja/locale/pl/LC_MESSAGES/django.mo b/redakcja/locale/pl/LC_MESSAGES/django.mo index 5c3c0723..7f35966d 100644 Binary files a/redakcja/locale/pl/LC_MESSAGES/django.mo and b/redakcja/locale/pl/LC_MESSAGES/django.mo differ diff --git a/redakcja/locale/pl/LC_MESSAGES/django.po b/redakcja/locale/pl/LC_MESSAGES/django.po index be86f7d7..916f4db0 100644 --- a/redakcja/locale/pl/LC_MESSAGES/django.po +++ b/redakcja/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-14 17:05+0200\n" -"PO-Revision-Date: 2011-10-14 17:12+0100\n" +"POT-Creation-Date: 2011-10-18 11:18+0200\n" +"PO-Revision-Date: 2011-10-18 11:19+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -44,7 +44,7 @@ msgid "" "Go to the document list\n" "or to your page instead." msgstr "" -"Jeśli skierował Cię tu Redmine, zwróć uwagę, że nie służy on już do koordynowania prac redakcyjnych. Możesz za to przejśćdo listy dokumentów\n" +"Jeśli skierował Cię tu Redmine, zwróć uwagę, że nie służy on już do koordynowania prac redakcyjnych. Możesz za to przejść do listy dokumentów\n" "albo do swojej strony." #: templates/base.html:7