From add48c78bc4b08dfda50b0c0ccb6be188c7d56f4 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 18 Oct 2011 11:20:03 +0200 Subject: [PATCH 1/1] move xml check to celery, typo fix --- apps/catalogue/tasks.py | 9 +++++++++ apps/catalogue/views.py | 6 +++++- redakcja/locale/pl/LC_MESSAGES/django.mo | Bin 1599 -> 1600 bytes redakcja/locale/pl/LC_MESSAGES/django.po | 6 +++--- 4 files changed, 17 insertions(+), 4 deletions(-) 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 5c3c07230a0eb38d6043d2a9ebf15c03bde3ac6a..7f35966daf95491b9fde3a579414e62801d8d20d 100644 GIT binary patch delta 104 zcmdnbbAV?;jqNoC28Ky23=CXAI+K-wffGoV0BLq0T?eG)fOH#>ZUxdyfiy^7n+>Ag kbmPusCUy%2LqjV=i^\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 -- 2.20.1