Exemple #1
0
def usersedit():
    if request.method == 'POST':
        data = request.form.to_dict()
        #print data
        user = userEdit(**data)
        return json.dumps({'status': 0})
    else:
        return redirect('/users')
Exemple #2
0
def users_edit():
    #errmsgs = ['[User cannot be null...]','[Email type wrong...]','[Email suffix error...]','Password type error...']
    if request.method == 'POST':
        data = request.form.to_dict()
        print 'form.to_dict:', data
        userEdit(data)
        '''
        ret = userEdit(data)
        if ret in errmsgs:
            return render_template('users_edit.html', errmsg=ret)
        else:
            return redirect('/users')
        '''
        return redirect('/users')
    if request.method == 'GET':
        data = request.args.get('num', '')
        print 'args.get:', data
        return render_template('users_edit.html', num=data)
Exemple #3
0
def users_edit(uid):
    if request.method == 'POST':
        data = request.form.to_dict()
        if data['password'] != data['rpassword']:
            errmsg = "Confirm password error"
            return render_template('users_add.html', errmsg=errmsg)
        print data
        response = userEdit(uid, data)
        print response
        return redirect("/users")
    else:
        users = get_users()
        for user in users:
            if user[0] == uid:
                return render_template('users_edit.html', user=user)
Exemple #4
0
def usersedit(uid):
    # () tuple
    response = userInfo(uid)
    #print response
    print response
    if request.method == 'POST':
        data = request.form.to_dict()
        #print data
        if data['password'] == data['rpassword']:
            user = userEdit(uid, **data)
            return redirect('/users')
        else:
            return render_template('users_edit.html',
                                   users=response,
                                   errmsg='confirm error.')
    else:
        return render_template('users_edit.html', users=response)