Refactor blog category post selection
This commit is contained in:
@ -20,8 +20,7 @@ def blog_index(page):
|
||||
|
||||
@cache.memoize(600)
|
||||
def blog_category(category, page):
|
||||
posts = get_blog_posts()
|
||||
category_posts = [(slug, post) for (slug, post) in posts if post['category'] and category in post['category']]
|
||||
category_posts = get_blog_posts(category=category)
|
||||
posts = get_for_page(category_posts, page, BLOG_POSTS_PER_PAGE)
|
||||
if not posts and page != 1:
|
||||
abort(404)
|
||||
|
Reference in New Issue
Block a user