Ejemplo n.º 1
0
    def post(self):
        form = nas_forms.bas_add_form()
        if not form.validates(source=self.get_params()):
            self.render("base_form.html", form=form)
            return
        if self.db.query(models.TraBas.id).filter_by(ip_addr=form.d.ip_addr).count() > 0:
            self.render("base_form.html", form=form, msg=u"Bas地址已经存在")
            return
        bas = models.TraBas()
        bas.ip_addr = form.d.ip_addr
        bas.bas_name = form.d.bas_name
        bas.time_type = form.d.time_type
        bas.vendor_id = form.d.vendor_id
        bas.portal_vendor = form.d.portal_vendor
        bas.bas_secret = form.d.bas_secret
        bas.coa_port = form.d.coa_port
        bas.ac_port = form.d.ac_port
        self.db.add(bas)

        ops_log = models.TraOperateLog()
        ops_log.operator_name = self.get_secure_cookie("tra_user")
        ops_log.operate_ip = self.get_secure_cookie("tra_login_ip")
        ops_log.operate_time = utils.get_currtime()
        ops_log.operate_desc = u'操作员(%s)新增BAS信息:%s' % (ops_log.operator_name, bas.ip_addr)
        self.db.add(ops_log)
        self.db.commit()

        self.redirect("/bas",permanent=False)
Ejemplo n.º 2
0
 def get(self):
     self.render("base_form.html", form=nas_forms.bas_add_form())