From 8d44f8a426e5214327adefe2154cf9739798e47b Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 11 Jun 2013 15:53:05 +0200 Subject: [PATCH] Don't break catalogue.pdf on unknown dc:audience. --- apps/catalogue/models/book.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index eab6b2de3..e80b8af73 100644 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -560,6 +560,7 @@ class Book(models.Model): return books_by_author, orphans, books_by_parent _audiences_pl = { + "SP": (1, u"szkoła podstawowa"), "SP1": (1, u"szkoła podstawowa"), "SP2": (1, u"szkoła podstawowa"), "P": (1, u"szkoła podstawowa"), @@ -569,7 +570,7 @@ class Book(models.Model): } def audiences_pl(self): audiences = self.extra_info.get('audiences', []) - audiences = sorted(set([self._audiences_pl[a] for a in audiences])) + audiences = sorted(set([self._audiences_pl.get(a, (99, a)) for a in audiences])) return [a[1] for a in audiences] def choose_fragment(self): -- 2.20.1