Ejemplo n.º 1
0
def edit_user_self():
    user_modify_form = form.UserModifyForm()
    if user_modify_form.validate_on_submit():
        try:
            ret = user_server.update_user(user_modify_form, for_self=True)
            if ret == 'OK':
                return u"修改用户成功"
            return u'修改用户失败: ' + ret
        except Exception, e:
            return u"修改用户失败: " + e.message
Ejemplo n.º 2
0
def edit_user_self():
    user_modify_form = form.UserModifyForm()
    if user_modify_form.validate_on_submit():
        try:
            ret = user_server.update_user(user_modify_form, for_self=True)
            if ret == 'OK':
                return u"修改用户成功"
            return u'修改用户失败: ' + ret
        except Exception, e:
            current_app.logger.error(traceback.format_exc())
            return u"修改用户失败: " + e.message
Ejemplo n.º 3
0
def edit_user():
    if not current_user.is_admin and not current_user.is_coach:
        return redirect(url_for('main.index'))
    user_modify_form = form.UserModifyForm()
    if user_modify_form.validate_on_submit():
        try:
            rights_list = request.form.getlist('rights')
            rights = 0
            for item in rights_list:
                rights = rights | int(item)
            ret = user_server.update_user(user_modify_form, rights)
            if ret == 'OK':
                return u"修改用户成功"
            return u'修改用户失败: ' + ret
        except Exception, e:
            return u"修改用户失败: " + e.message