本文整理汇总了Python中Cheetah.Template.Template.workdir方法的典型用法代码示例。如果您正苦于以下问题:Python Template.workdir方法的具体用法?Python Template.workdir怎么用?Python Template.workdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cheetah.Template.Template
的用法示例。
在下文中一共展示了Template.workdir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_error
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import workdir [as 别名]
def show_error(req, error, text = ""):
t = Template(file=tmpl_prefix + "error.tmpl")
t.workdir = workdir
t.title = "Error"
t.error = error
t.text = text
req.write(str(t))
示例2: show_logfile
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import workdir [as 别名]
def show_logfile(req, host):
try:
log = remotevm.getLog(host)
except:
return show_error(req, "failed to contact manager", traceback.format_exc())
t = Template(file=tmpl_prefix + "logfile.tmpl")
t.title = "Log from host %s" % host
t.log = re.compile('\n').sub('<br>\n', log)
t.host = host
t.workdir = workdir
req.write(str(t))
示例3: show_configure
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import workdir [as 别名]
def show_configure(req, host, cfgtext = None):
if cfgtext is not None:
#sys.stderr.write("cfgtext: '%s'" % cfgtext)
remotevm.setConfig(host, cfgtext)
remotevm.reparseVermontConfigs()
t = Template(file=tmpl_prefix + "configure.tmpl")
t.title = "Configure host %s" % host
t.host = host
t.workdir = workdir
(t.cfgtext, t.dyncfgtext) = [ cgi.escape(x) for x in remotevm.getConfigs(host) ]
req.write(str(t))
示例4: show_manager_log
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import workdir [as 别名]
def show_manager_log(req):
try:
log = remotevm.getManagerLog()
except:
return show_error(req, "failed to contact manager", traceback.format_exc())
t = Template(file=tmpl_prefix + "logfile.tmpl")
t.title = "Log from Vermont Manager"
t.log = re.compile('\n').sub('<br>\n', cgi.escape(log))
t.host = url
t.workdir = workdir
req.write(str(t))
示例5: show_instance_list
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import workdir [as 别名]
def show_instance_list(req, hosts):
try:
stati = remotevm.getStati()
dynconfenabled = remotevm.getDynconfEnabled()
except:
return show_error(req, "failed to contact manager", traceback.format_exc())
t = Template(file=tmpl_prefix + "instance_list.tmpl")
t.workdir = workdir
t.title = "Vermont Manager"
t.hosts = hosts
t.stati = stati
t.dynconfenabled = dynconfenabled
req.content_type = "text/html"
req.write(str(t))
示例6: show_statistics
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import workdir [as 别名]
def show_statistics(req, host):
try:
names = remotevm.getGraphList(host)
except:
return show_error(req, "failed to contact manager", traceback.format_exc())
t = Template(file=tmpl_prefix + "statistics.tmpl")
t.title = "Statistics for host %s" % host
t.host = host
t.stats = []
t.workdir = workdir
i = 0
for n in names:
t.stats.append({'name': n, 'idx': i})
i += 1
req.write(str(t))
示例7: show_sensor_data
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import workdir [as 别名]
def show_sensor_data(req, host):
try:
sdata = remotevm.getSensorData(host)
except:
return show_error(req, "failed to contact manager", traceback.format_exc())
html = Ft.Xml.Xslt.Transform(Ft.Xml.InputSource.DefaultFactory.fromString(sdata), workdir+"/sensor_output.xsl")
#sys.stderr.write("
html = html.replace('%modulegraph_url%', "start.py?vi_host=%s&action=modulegraph" % host)
t = Template(file=tmpl_prefix + "sensor_data.tmpl")
t.title = "Statistics for host %s" % host
t.host = host
t.workdir = workdir
t.stat = html
statxml = cgi.escape(sdata)
t.xml = statxml.replace("\n", "<br />\n")
req.write(str(t))