handle no epub in opds
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 19 Mar 2012 09:31:32 +0000 (10:31 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 19 Mar 2012 09:31:32 +0000 (10:31 +0100)
apps/opds/views.py

index 4f1bec0..09aaa54 100644 (file)
@@ -185,10 +185,10 @@ class AcquisitionFeed(Feed):
             return u''
 
     def item_enclosure_url(self, book):
-        return full_url(book.epub_file.url)
+        return full_url(book.epub_file.url) if book.epub_file else None
 
     def item_enclosure_length(self, book):
-        return book.epub_file.size
+        return book.epub_file.size if book.epub_file else None
 
 @piwik_track
 class RootFeed(Feed):