示例#1
0
文件: app.py 项目: shernandezp/python
def hello():
    userAccess = UserAccess()
    if request.method == 'POST':
        result = request.form
        newUser = User()

        for key, value in result.items():
            if key == "txtname":
                newUser.username = value
            elif key == "txtpass":
                newUser.password = value
            elif key == "txtemail":
                newUser.email = value
        userAccess.InsertUser(newUser)

    users = userAccess.GetUsers()
    return render_template("index.html", users=users)
示例#2
0
文件: app.py 项目: shernandezp/python
def insert_user():
    userAccess = UserAccess()
    user = json.loads(json.dumps(request.json, cls=DateTimeEncoder),
                      object_hook=User)
    result = userAccess.InsertUser(user)
    return JSONEncoder().encode(result)