#1060: sorted and unique editors' names
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 24 Jan 2011 11:52:47 +0000 (12:52 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 24 Jan 2011 11:52:47 +0000 (12:52 +0100)
some tests fixes

apps/catalogue/templatetags/catalogue_tags.py
apps/catalogue/test_utils.py
lib/librarian
wolnelektury/templates/catalogue/book_text.html

index 29b4f2b..3a60a06 100644 (file)
@@ -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
index 398a0fe..1dcd726 100644 (file)
@@ -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)
index a2f8ee8..0fd2ed2 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a2f8ee881d66601e9cb714069dc88d3ed9703db6
+Subproject commit 0fd2ed230ea6d53adb5e627731672c996485167b
index 3bf3359..34232ec 100644 (file)
               <p>{{ book.get_extra_info_value.description }}</p>
             {% 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 %}
               <p>{% 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 %}.</p>
+                  {% all_editors book.get_extra_info_value %}.</p>
             {% endif %}