def get_blog(id):
blog = yield from Blog.find(id)
if not blog:
raise APIValueError('id', 'can not find blog id is :{}'.format(id))
comments = yield from Comment.find_all('blog_id=?', [id], order_by='created_at desc')
for c in comments:
c.html_content = text2html(c.content)
blog.html_content = markdown2.markdown(blog.content)
return {
'__template__': 'blog.html',
'blog': blog,
'comments': comments
}
评论列表
文章目录