コード例 #1
0
def findUser():
    id = request.form['id']
    user = User()
    users = user.search_all_users()
    try:
        response = user.search_user_by_id(id)
        if response == False:
            return "Erro ao buscar usuário"
        else:
            return render_template('/users.html', users=users, user1=response)

    except Exception as e:
        return 'Erro no servidor. Contate o analista responsável!'
コード例 #2
0
ファイル: api02.py プロジェクト: enanlara/2TsServer
def findUser():
    if session.get('token') is None:
        return render_template(
            '/login.html',
            message="You have to login to access this module",
            alertlevel="warning")
    id = request.form['userId']
    user = User()
    users = user.search_all_users()
    try:
        response = user.search_user_by_id(id)
        if response == False:
            return render_template('/users.html',
                                   message="Error finding user",
                                   alertlevel="danger")
        else:
            return render_template('/users.html', users=users, user1=response)

    except Exception as e:
        return render_template(
            '/users.html',
            message=
            "A database error has occurred. Contact your system administrator",
            alertlevel="danger")