From 1d85ebc2439c19626574166d4f37ae4990fdbf27 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 24 Jan 2011 12:52:47 +0100 Subject: [PATCH] #1060: sorted and unique editors' names some tests fixes --- apps/catalogue/templatetags/catalogue_tags.py | 6 ++++-- apps/catalogue/test_utils.py | 1 + lib/librarian | 2 +- wolnelektury/templates/catalogue/book_text.html | 5 ++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/catalogue/templatetags/catalogue_tags.py b/apps/catalogue/templatetags/catalogue_tags.py index 29b4f2b83..3a60a0634 100644 --- a/apps/catalogue/templatetags/catalogue_tags.py +++ b/apps/catalogue/templatetags/catalogue_tags.py @@ -140,8 +140,10 @@ def book_tree(book_list, books_by_parent): @register.simple_tag -def person_name(person): - return ' '.join(p.strip() for p in person.split(',')[::-1]) +def all_editors(extra_info): + return ', '.join( + ' '.join(p.strip() for p in person.rsplit(',', 1)[::-1]) + for person in sorted(set(extra_info['editors'] + extra_info['technical_editors']))) @register.simple_tag diff --git a/apps/catalogue/test_utils.py b/apps/catalogue/test_utils.py index 398a0fee2..1dcd7266a 100644 --- a/apps/catalogue/test_utils.py +++ b/apps/catalogue/test_utils.py @@ -10,6 +10,7 @@ class WLTestCase(TestCase): """ def setUp(self): self._MEDIA_ROOT, settings.MEDIA_ROOT = settings.MEDIA_ROOT, tempfile.mkdtemp(prefix='djangotest_') + settings.NO_BUILD_EPUB = settings.NO_BUILD_TXT = True def tearDown(self): shutil.rmtree(settings.MEDIA_ROOT, True) diff --git a/lib/librarian b/lib/librarian index a2f8ee881..0fd2ed230 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit a2f8ee881d66601e9cb714069dc88d3ed9703db6 +Subproject commit 0fd2ed230ea6d53adb5e627731672c996485167b diff --git a/wolnelektury/templates/catalogue/book_text.html b/wolnelektury/templates/catalogue/book_text.html index 3bf33590e..34232ecf4 100644 --- a/wolnelektury/templates/catalogue/book_text.html +++ b/wolnelektury/templates/catalogue/book_text.html @@ -44,10 +44,9 @@

{{ book.get_extra_info_value.description }}

{% endif %} - {% if book.get_extra_info_value.technical_editors or book.get_extra_info_value.editors %} + {% if book.get_extra_info_value.editors or book.get_extra_info_value.technical_editors %}

{% trans "Edited and annotated by:" %} - {% for name in book.get_extra_info_value.technical_editors|add:book.get_extra_info_value.editors %}{% if not forloop.first %}, {% endif %} - {% person_name name %}{% endfor %}.

+ {% all_editors book.get_extra_info_value %}.

{% endif %} -- 2.20.1