def SrcList(self,auth=None): so = LogSrc.select() fco = CommonFilter(LogSrc,logger=SelfFailureLoggerModel.addlog) fco.AddFilter("an","app.name","eq",title="应用名") fco.AddFilter("n","name","eq",title="来源名") so = fco.Filter(request,so) try: pgid = int(request.query.get('page','1')) except: pgid = 0 pco = PageCounter(so,20) pco.setCurrentPage(pgid) lpg = so.order_by(LogSrc.id).paginate(pgid,20) hqo = HTTPQueryArgs(request) SelfFailureLoggerModel.addlog(logging.DEBUG,'text/plain',hqo.args) kwvars = { "fthtml":fco.RenderHTML(request), #"fthtml":"", "pco": pco, "hqo": hqo, "lPage": lpg, "PageTitle":"应用管理", "auth":auth, } return template('src.list.html',**kwvars)
def AppList(self,auth=None): ao = LogApp.select() try: pgid = int(request.query.get('page','1')) except: pgid = 0 pco = PageCounter(ao,20) pco.setCurrentPage(pgid) lpg = ao.order_by(LogApp.id).paginate(pgid,20) hqo = HTTPQueryArgs(request) SelfFailureLoggerModel.addlog(logging.DEBUG,'text/plain',hqo.args) kwvars = { "pco": pco, "hqo": hqo, "lPage": lpg, "PageTitle":"应用管理", "auth":auth, } return template('app.list.html',**kwvars)
def LogList(self,auth=None): lo = LogItem.select() fco = CommonFilter(LogItem,logger=SelfFailureLoggerModel.addlog) tpch = { "text/plain":"纯文本", "text/html":"HTML", "text/markdown":"Markdown", } lvch = { logging.CRITICAL:"CRITICAL", logging.ERROR:"ERROR", logging.WARNING:"WARNING", logging.INFO:"INFO", logging.DEBUG:"DEBUG", } fco.AddFilter("lv","level","gte",title="级别",choices=lvch) fco.AddFilter("st","time","gte",title="起始时间",datecontrol=True) fco.AddFilter("et","time","lte",title="结束时间",datecontrol=True) fco.AddFilter("tp","type","sc",title="数据类型",choices=tpch,editable=True) lo = fco.Filter(request,lo) try: pgid = int(request.query.get('page','1')) except: pgid = 0 pco = PageCounter(lo,20) pco.setCurrentPage(pgid) lpg = lo.order_by(-LogItem.time).paginate(pgid,20) hqo = HTTPQueryArgs(request) #SelfFailureLoggerModel.addlog(logging.DEBUG,'text/plain',hqo.render_with_tempargs({"page":2})) kwvars = { "fthtml":fco.RenderHTML(request), "pco": pco, "hqo": hqo, "lPage": lpg, "PageTitle":"日志列表", "auth":auth, "MakeSummary":MakeSummary, } return template('log.list.html',**kwvars)