def get(self, id): cate = Category.get_cat_by_id(id) page = self._get_page() books = Book.get_page_books_by_cate(id, page) if not books and page != 1: raise HTTPError(404) pagination = Pagination(page, 30, cate["count"]) self.render("cate.html", cate=cate, pagination=pagination, books=books)
def get(self, id): book = Book.get_book_by_id(id) if not book: raise HTTPError(404) cate = Category.get_cat_by_id(book["category_id"]) author = Author.get_author_by_id(book["author_id"]) cover = get_cover(book['id'], book['cover']); self.render("book.html", book=book, cover=cover, cate=cate, author=author)
def render(self, template, **args): try: template = self.env.get_template(template) except TemplateNotFound: raise HTTPError(404) args['categories'] = Category.get_all_cat() self.env.globals['request'] = self.request self.env.globals['static_url'] = self.static_url self.env.globals['xsrf_form_html'] = self.xsrf_form_html self.write(template.render(args))
def get(self, id): cate = Category.get_cat_by_id(id) page = self._get_page() books = Book.get_page_books_by_cate(id, page) if not books and page != 1: raise HTTPError(404) pagination = Pagination(page, 30, cate["count"]) self.render("cate.html", cate=cate, pagination=pagination, books=books )
def get(self, id): book = Book.get_book_by_id(id) if not book: raise HTTPError(404) cate = Category.get_cat_by_id(book["category_id"]) author = Author.get_author_by_id(book["author_id"]) cover = get_cover(book['id'], book['cover']) self.render("book.html", book=book, cover=cover, cate=cate, author=author)