예제 #1
0
def blog(blog_id):
    blog = Blogs.get(blog_id)
    if blog is None:
        raise HttpError.notfound()
    blog.html_content = markdown.markdown(blog.content)
    comments = Comments.find_by(
        'where blog_id=? order by created_at desc limit 1000', blog_id)
    return dict(blog=blog, comments=comments, user=ctx.request.user)
예제 #2
0
def manage_blogs_edit(blog_id):
    blog = Blogs.get(blog_id)
    if blog is None:
        raise HttpError.notfound()
    return dict(id=blog.id,
                name=blog.name,
                summary=blog.summary,
                content=blog.content,
                action=path_join(_MODULE, '/api/blogs/%s' % blog_id),
                redirect=path_join(_MODULE, '/manage/blogs'),
                user=ctx.request.user)