blog.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:M101P-mongodb-course-2016 作者: mahasagar 项目源码 文件源码
def show_post(permalink="notfound"):

    cookie = bottle.request.get_cookie("session")

    username = sessions.get_username(cookie)
    permalink = cgi.escape(permalink)

    print "about to query on permalink = ", permalink
    post = posts.get_post_by_permalink(permalink)

    if post is None:
        bottle.redirect("/post_not_found")

    # init comment form fields for additional comment
    comment = {'name': "", 'body': "", 'email': ""}

    return bottle.template("entry_template",
                           {"post": post, "username": username, "errors": "",
                            "comment": comment})


# used to process a comment on a blog post
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号