+ @classmethod
+ def children(cls, book):
+ """ Returns all children for a book. """
+
+ return book.children.all()
+
+ @classmethod
+ def media(cls, book):
+ """ Returns all media for a book. """
+ return book.media.all()
+
+ @classmethod
+ def cover(cls, book):
+ return MEDIA_BASE + book.cover.url if book.cover else ''
+
+ @classmethod
+ def cover_thumb(cls, book):
+ return MEDIA_BASE + default.backend.get_thumbnail(
+ book.cover, "139x193").url if book.cover else ''
+
+
+
+class BookDetailHandler(BaseHandler, BookDetails):
+ """ Main handler for Book objects.
+
+ Responsible for single Book details.
+ """
+ allowed_methods = ['GET']
+ fields = ['title', 'parent', 'children'] + Book.formats + [
+ 'media', 'url', 'cover', 'cover_thumb'] + [
+ category_plural[c] for c in book_tag_categories]
+
+ @piwik_track
+ def read(self, request, book):
+ """ Returns details of a book, identified by a slug and lang. """
+ try:
+ return Book.objects.get(slug=book)
+ except Book.DoesNotExist:
+ return rc.NOT_FOUND
+
+
+class AnonymousBooksHandler(AnonymousBaseHandler, BookDetails):
+ """ Main handler for Book objects.
+
+ Responsible for lists of Book objects.
+ """
+ allowed_methods = ('GET',)
+ model = Book
+ fields = ['author', 'href', 'title', 'url', 'cover']
+
+ @piwik_track
+ def read(self, request, tags, top_level=False,
+ audiobooks=False, daisy=False):