Ejemplo n.º 1
0
    def post(self):
        form = ssid_form.ssid_add_form([])
        if not form.validates(source=self.get_params()):
            return self.render("base_form.html", form=form)
        if self.db.query(models.TraSsid.id).filter_by(ssid=form.d.ssid).count() > 0:
            return self.render("base_form.html", form=form, msg=u"ssid已经存在")
        mssid = models.TraSsid()
        mssid.domain_code = form.d.domain_code
        mssid.ssid = form.d.ssid
        mssid.ssid_desc = form.d.ssid_desc
        self.db.add(mssid)

        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)新增SSID信息:%s' % (ops_log.operator_name, mssid.ssid)
        self.db.add(ops_log)

        self.db.commit()
        self.redirect("/ssid",permanent=False)
Ejemplo n.º 2
0
 def get(self):
     domains = [(m.domain_code, m.domain_desc) for m in self.db.query(models.TraDomain)]
     self.render("base_form.html", form=ssid_form.ssid_add_form(domains))