# 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 sys
import os
import time
        import traceback
from toughlib import utils
from toughwlan import models
from sqlalchemy.orm import scoped_session, sessionmaker
from toughlib.dbengine import get_engine
from hashlib import md5

    tplattr2 = models.TrwDomainAttr()
    tplattr2.isp_code = 'default'
    tplattr2.domain_code = 'default'
    tplattr2.tpl_name = 'default'
    tplattr2.attr_name = 'logo_url'
    tplattr2.attr_value = u'/static/img/plogin.png'
    tplattr2.attr_desc = u'logo地址'

    tplattr3 = models.TrwDomainAttr()
    tplattr3.isp_code = 'default'
    tplattr3.domain_code = 'default'
    tplattr3.tpl_name = 'default'
    tplattr3.attr_name = 'home_page'
    tplattr3.attr_value = u'/portal/index'
    tplattr3.attr_desc = u'认证成功重定向主页'

    db.add(tplattr1)
    db.add(tplattr2)
    db.add(tplattr3)


    db.commit()
    db.close()

def update(config,force=False):
    print 'starting update database...'
    try:
        if int(os.environ.get("DB_INIT", 1)) == 1 or force:
            db_engine = get_engine(config)

# 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/common/initdb.py
import sys
import os
import time
        import traceback
from toughlib import utils
from toughwlan import models
from sqlalchemy.orm import scoped_session, sessionmaker
from toughlib.dbengine import get_engine
from hashlib import md5


    tplattr2 = models.TrwDomainAttr()
    tplattr2.isp_code = 'default'
    tplattr2.domain_code = 'default'
    tplattr2.tpl_name = 'default'
    tplattr2.attr_name = 'logo_url'
    tplattr2.attr_value = u'/static/img/plogin.png'
    tplattr2.attr_desc = u'logo地址'

    tplattr3 = models.TrwDomainAttr()
    tplattr3.isp_code = 'default'
    tplattr3.domain_code = 'default'
    tplattr3.tpl_name = 'default'
    tplattr3.attr_name = 'home_page'
    tplattr3.attr_value = u'/portal/index'
    tplattr3.attr_desc = u'认证成功重定向主页'

    db.add(tplattr1)
    db.add(tplattr2)
    db.add(tplattr3)


    db.commit()
    db.close()

def update(config,force=False):
    print 'starting update database...'
    try:
        if int(os.environ.get("DB_INIT", 1)) == 1 or force:
            db_engine = get_engine(config)

            metadata = models.get_metadata(db_engine)