def GET(self): web.header("Content-Type","text/html; charset=utf-8") node_id = web.input().get("node_id") group_id = web.input().get("group_id") db = get_db() group = db.query(models.RadGroup)\ .filter(models.RadGroup.node_id == node_id)\ .filter(models.RadGroup.group_id == group_id).first() form = forms.group_update_form() form.fill(group) return render("baseform.html",form=form,title="修改用户组",action="/group/update")
def GET(self): web.header("Content-Type", "text/html; charset=utf-8") node_id = web.input().get("node_id") group_id = web.input().get("group_id") db = get_db() group = db.query(models.RadGroup)\ .filter(models.RadGroup.node_id == node_id)\ .filter(models.RadGroup.group_id == group_id).first() form = forms.group_update_form() form.fill(group) return render("baseform.html", form=form, title="修改用户组", action="/group/update")
def POST(self): web.header("Content-Type","text/html; charset=utf-8") form = forms.group_update_form() if not form.validates(): return render("baseform.html",form=form,title="修改用户组",action="/group/update") else: db = get_db() group = db.query(models.RadGroup)\ .filter(models.RadGroup.node_id == form.d.node_id)\ .filter(models.RadGroup.group_id == form.d.group_id).first() if not group: return errorpage("用户组不存在") try: group.group_name = form.d.group_name db.commit() db.flush() except Exception,e: db.rollback() log.error("update group error: %s"%str(e)) return errorpage("修改用户组失败 %s"%str(e)) raise web.seeother("/group",absolute=True)
def group_add_update(db): form = forms.group_update_form() if not form.validates(source=request.forms): return render("base_form", form=form) group = db.query(models.SlcRadGroup).get(form.d.id) group.group_name = form.d.group_name group.group_desc = form.d.group_desc group.bind_mac = form.d.bind_mac group.bind_vlan = form.d.bind_vlan group.concur_number = form.d.concur_number group.update_time = utils.get_currtime() ops_log = models.SlcRadOperateLog() ops_log.operator_name = get_cookie("username") ops_log.operate_ip = get_cookie("login_ip") ops_log.operate_time = utils.get_currtime() ops_log.operate_desc = u'操作员(%s)修改用户组信息:%s' % (get_cookie("username"), serial_json(group)) db.add(ops_log) db.commit() websock.update_cache("group", group_id=group.id) redirect("/group")
def POST(self): web.header("Content-Type", "text/html; charset=utf-8") form = forms.group_update_form() if not form.validates(): return render("baseform.html", form=form, title="修改用户组", action="/group/update") else: db = get_db() group = db.query(models.RadGroup)\ .filter(models.RadGroup.node_id == form.d.node_id)\ .filter(models.RadGroup.group_id == form.d.group_id).first() if not group: return errorpage("用户组不存在") try: group.group_name = form.d.group_name db.commit() db.flush() except Exception, e: db.rollback() log.error("update group error: %s" % str(e)) return errorpage("修改用户组失败 %s" % str(e)) raise web.seeother("/group", absolute=True)
def group_update(db): group_id = request.params.get("group_id") form = forms.group_update_form() form.fill(db.query(models.SlcRadGroup).get(group_id)) return render("base_form", form=form)