def GET(self): #posts totalPosts = post_service.count_all() totalPostsPublished = post_service.count_published() totalUnpublishedPosts = totalPosts - totalPostsPublished unpublishedPosts = None if totalUnpublishedPosts > 0: unpublishedPosts = post_service.get_unpublished(0, totalUnpublishedPosts) #pages totalPages = page_service.count_all() totalPagesPublished = page_service.count_published() totalUnpublishedPages = tag_service.count_unpublished() unpublishedPages = None if totalUnpublishedPages > 0: unpublishedPages = page_service.get_unpublished(0, totalUnpublishedPages) #Topics totalTopics = tag_service.count_all() totalTopicsPublished = tag_service.count_published() totalTopicsUnPublished = tag_service.count_unpublished() unpublishedTopics = None if totalTopicsUnPublished > 0: unpublishedTopics = tag_service.get_unpublished() return render.index(totalPosts, totalPostsPublished, unpublishedPosts, totalPages, totalPagesPublished, unpublishedPages, totalTopics, totalTopicsPublished, totalTopicsUnPublished, unpublishedTopics)
def GET(self): p = safe_number(web.input(page="1").page) limit = blog_settings.items_per_page offset = start_index(p, limit) pageCount = total_page(post_service.count_published(), limit) posts = post_service.get_published(offset, limit) nextLink = "?page=" + str(p + 1) if p < pageCount else None previousLink = "?page=" + str(p - 1) if p > 1 else None return render.index(posts, nextLink, previousLink)
def GET(self, page=1): p = safe_number(page) limit = blog_settings.items_per_page offset = start_index(p, limit) totalPosts = post_service.count_all() totalPostsPublished = post_service.count_published() pageCount = total_page(totalPostsPublished, limit) posts = post_service.get_published(offset, limit) nextLink = str(p + 1) if p < pageCount else None previousLink = str(p - 1) if p > 1 else None return render.posts(totalPosts, totalPostsPublished, posts, nextLink, previousLink)