def bas_add_update(db, render): form = bas_forms.bas_update_form() if not form.validates(source=request.forms): return render("base_form", form=form) bas = db.query(models.SlcRadBas).get(form.d.id) bas.bas_name = form.d.bas_name bas.time_type = form.d.time_type bas.vendor_id = form.d.vendor_id bas.bas_secret = form.d.bas_secret bas.coa_port = form.d.coa_port 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)修改BAS信息:%s' % (get_cookie("username"), bas.ip_addr) db.add(ops_log) db.commit() websock.update_cache("bas", ip_addr=bas.ip_addr) redirect("/bas")
def bas_update(db, render): bas_id = request.params.get("bas_id") form = bas_forms.bas_update_form() form.fill(db.query(models.SlcRadBas).get(bas_id)) return render("base_form", form=form)