fixes #814: 404 when no html
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 7 Sep 2010 07:58:05 +0000 (09:58 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 7 Sep 2010 07:58:46 +0000 (09:58 +0200)
apps/catalogue/views.py

index d9ae442..088d0ee 100644 (file)
@@ -262,6 +262,8 @@ def book_stub_detail(request, slug):
 
 def book_text(request, slug):
     book = get_object_or_404(models.Book, slug=slug)
 
 def book_text(request, slug):
     book = get_object_or_404(models.Book, slug=slug)
+    if not book.has_html_file():
+        raise Http404
     book_themes = {}
     for fragment in book.fragments.all():
         for theme in fragment.tags.filter(category='theme'):
     book_themes = {}
     for fragment in book.fragments.all():
         for theme in fragment.tags.filter(category='theme'):