blog.py 文件源码

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

项目:M101P-mongodb-course-2016 作者: mahasagar 项目源码 文件源码
def process_signup():

    email = bottle.request.forms.get("email")
    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")
    verify = bottle.request.forms.get("verify")

    # set these up in case we have an error case
    errors = {'username': cgi.escape(username), 'email': cgi.escape(email)}
    if validate_signup(username, password, verify, email, errors):

        if not users.add_user(username, password, email):
            # this was a duplicate
            errors['username_error'] = ("Username already in use. " +
                                        "Please choose another")
            return bottle.template("signup", errors)

        session_id = sessions.start_session(username)
        print session_id
        bottle.response.set_cookie("session", session_id)
        bottle.redirect("/welcome")
    else:
        print "user did not validate"
        return bottle.template("signup", errors)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号