# Path: toughwlan/manage/base.py
# ADMIN_MENUS = (MenuSys, MenuRes, MenuUser) = (u"系统管理", u"资源管理", u"用户管理")
# MENU_ICONS = {
#     u"系统管理": "fa fa-cog",
#     u"资源管理": "fa fa-desktop",
#     u"用户管理": "fa fa-users"
# }
# class BaseHandler(cyclone.web.RequestHandler):
#     def __init__(self, *argc, **argkw):
#     def initialize(self):
#     def on_finish(self):
#     def get_error_html(self, status_code=500, **kwargs):
#     def render(self, template_name, **template_vars):
#     def render_error(self, **template_vars):
#     def render_json(self, **template_vars):
#     def render_string(self, template_name, **template_vars):
#     def render_from_string(self, template_string, **template_vars):
#     def get_page_data(self, query):
#     def get_page_url(self, page, form_id=None):
#     def set_session_user(self, username, ipaddr, opr_type, login_time):
#     def clear_session(self):
#     def get_current_user(self):
#     def get_params(self):
#     def get_params_obj(self, obj):
#     def add_oplog(self,message):
# 
# Path: toughwlan/manage/resource/radius_form.py

# 
# Path: toughwlan/models.py
# def get_metadata(db_engine):
# class SystemSession(DeclarativeBase):
# class SystemCache(DeclarativeBase):
# class TrwOperator(DeclarativeBase):
# class TrwOperatorRule(DeclarativeBase):
# class TrwParam(DeclarativeBase):
# class TrwIsp(DeclarativeBase):
# class TrwIspService(DeclarativeBase):
# class TrwBas(DeclarativeBase):
# class TrwDomain(DeclarativeBase):
# class TrwDomainAttr(DeclarativeBase):
# class TrwSsid(DeclarativeBase):
# class TrwRadius(DeclarativeBase):
# class TrwTemplate(DeclarativeBase):
# class TrwOperateLog(DeclarativeBase):
# class TrwOSTypes(DeclarativeBase):


import cyclone.web
from toughlib import utils
from toughwlan.manage.base import BaseHandler, MenuRes
from toughlib.permit import permit
from toughwlan.manage.resource import radius_form
from toughwlan import models
            return self.render("base_form.html", form=form, msg=u"ip地址已经存在")

        radius = models.TrwRadius()
        radius.ip_addr = form.d.ip_addr
        radius.name = form.d.name
        radius.secret = form.d.secret
        radius.acct_port = form.d.acct_port
        radius.auth_port = form.d.auth_port
        radius.api_url = form.d.api_url
        radius.api_secret = form.d.api_secret
        radius.serv_type = form.d.serv_type
        radius.last_check = utils.get_currtime()
        self.db.add(radius)

        self.add_oplog(u'新增Radius信息:%s' % (radius.ip_addr))
        self.db.commit()
        self.redirect("/radius", permanent=False)


@permit.route(r"/radius/update", u"Radius节点修改", MenuRes, order=2.0004)
class UpdateHandler(BaseHandler):
    @cyclone.web.authenticated
    def get(self):
        radius_id = self.get_argument("radius_id")
        radius = self.db.query(models.TrwRadius).get(radius_id)
        form = radius_form.radius_update_form()
        form.fill(radius)
        return self.render("base_form.html", form=form)

    def post(self):

# Path: toughwlan/manage/base.py
# ADMIN_MENUS = (MenuSys, MenuRes, MenuUser) = (u"系统管理", u"资源管理", u"用户管理")
# MENU_ICONS = {
#     u"系统管理": "fa fa-cog",
#     u"资源管理": "fa fa-desktop",
#     u"用户管理": "fa fa-users"
# }
# class BaseHandler(cyclone.web.RequestHandler):
#     def __init__(self, *argc, **argkw):
#     def initialize(self):
#     def on_finish(self):
#     def get_error_html(self, status_code=500, **kwargs):
#     def render(self, template_name, **template_vars):
#     def render_error(self, **template_vars):
#     def render_json(self, **template_vars):
#     def render_string(self, template_name, **template_vars):
#     def render_from_string(self, template_string, **template_vars):
#     def get_page_data(self, query):
#     def get_page_url(self, page, form_id=None):
#     def set_session_user(self, username, ipaddr, opr_type, login_time):
#     def clear_session(self):
#     def get_current_user(self):
#     def get_params(self):
#     def get_params_obj(self, obj):
#     def add_oplog(self,message):
# 
# Path: toughwlan/manage/resource/radius_form.py

# 
# Path: toughwlan/models.py
# def get_metadata(db_engine):
# class SystemSession(DeclarativeBase):
# class SystemCache(DeclarativeBase):
# class TrwOperator(DeclarativeBase):
# class TrwOperatorRule(DeclarativeBase):
# class TrwParam(DeclarativeBase):
# class TrwIsp(DeclarativeBase):
# class TrwIspService(DeclarativeBase):
# class TrwBas(DeclarativeBase):
# class TrwDomain(DeclarativeBase):
# class TrwDomainAttr(DeclarativeBase):
# class TrwSsid(DeclarativeBase):
# class TrwRadius(DeclarativeBase):
# class TrwTemplate(DeclarativeBase):
# class TrwOperateLog(DeclarativeBase):
# class TrwOSTypes(DeclarativeBase):


# Path: toughwlan/manage/resource/radius.py
import cyclone.web
from toughlib import utils
from toughwlan.manage.base import BaseHandler, MenuRes
from toughlib.permit import permit
from toughwlan.manage.resource import radius_form
from toughwlan import models

            return self.render("base_form.html", form=form, msg=u"ip地址已经存在")

        radius = models.TrwRadius()
        radius.ip_addr = form.d.ip_addr
        radius.name = form.d.name
        radius.secret = form.d.secret
        radius.acct_port = form.d.acct_port
        radius.auth_port = form.d.auth_port
        radius.api_url = form.d.api_url
        radius.api_secret = form.d.api_secret
        radius.serv_type = form.d.serv_type
        radius.last_check = utils.get_currtime()
        self.db.add(radius)

        self.add_oplog(u'新增Radius信息:%s' % (radius.ip_addr))
        self.db.commit()
        self.redirect("/radius", permanent=False)


@permit.route(r"/radius/update", u"Radius节点修改", MenuRes, order=2.0004)
class UpdateHandler(BaseHandler):
    @cyclone.web.authenticated
    def get(self):
        radius_id = self.get_argument("radius_id")
        radius = self.db.query(models.TrwRadius).get(radius_id)
        form = radius_form.radius_update_form()
        form.fill(radius)
        return self.render("base_form.html", form=form)

    def post(self):

        form = radius_form.radius_update_form([])