本文整理汇总了Python中Cheetah.Template.Template.host方法的典型用法代码示例。如果您正苦于以下问题:Python Template.host方法的具体用法?Python Template.host怎么用?Python Template.host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cheetah.Template.Template
的用法示例。
在下文中一共展示了Template.host方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_logfile
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [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))
示例2: show_configure
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [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))
示例3: show_manager_log
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [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))
示例4: show_statistics
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [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))
示例5: show_sensor_data
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [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))
示例6: _make_apacheconf
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [as 别名]
def _make_apacheconf(self):
""" make apache conf """
file_name = os.path.join(current_dir,'templates', 'inner_vhost.conf.tmpl')
tpl = Template(file=file_name)
for backend in self.backends:
tpl.backend = backend
tpl.host = backend['host']
tpl.zope2_vhm_maps = self.zope2_vhm_maps.get(backend['host'], None)
tpl.bind = self.options['bind']
tpl.log_dir = self.options['log_dir']
tpl.port = self.options['port']
tpl.log_format = self.options['log_format']
tpl.etag = self.options['etag']
tpl.compression = self.options['compression']
tpl.extras = self.options['extras']
tpl.resources_map = self.resources_map
tpl.redirects_map = self.redirects_map.get(backend['host'], None)
tpl.filematch_map = fm = []
for match, value in sorted(self.filematch_map.items()):
value = value.copy()
value['match'] = match
fm.append(value)
fd = open(os.path.join(self.options['config_dir'],
"virtual_%s.conf" % (backend['host'],) ),'w')
print >> fd, tpl
fd = open(self.options['mainconfig'])
content = fd.read()
fd.close()
include = "Include %s/*.conf\n" % self.options['config_dir']
if include not in content:
if os.access(self.options['mainconfig'], os.W_OK):
fd = open(self.options['mainconfig'],'a')
fd.write("Include %s/*.conf\n" % self.options['config_dir'])
fd.close()
else:
print "\nThe file %s is not writable" % self.options['mainconfig']
print "Please ask your system adminsitrator to add the following line in it:\n"
print "Include %s/*.conf\n\n" % self.options['config_dir']
示例7: Template
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [as 别名]
img_file = '/'.join([SCAN_HOME, fibasic.scan_id])
plot.savefig(img_file)
# ---------------------------------------------------------
# HTML Webpage
TMPL_FILE = '/'.join([SCAN_HOME, 'fibasic-results.tmpl'])
html = Template(file=TMPL_FILE)
html.no_results = False
if len(high) == 0 and len(medium) == 0 and len(low) == 0:
html.no_results = True
else:
html.img = '.'.join([str(fibasic.scan_id), 'png'])
html.host = fibasic.hostname
html.high = high
html.medium = medium
html.low = low
page_file = '%s.html' % fibasic.scan_id
fd = open('/'.join([SCAN_HOME, page_file]), 'w')
fd.write(html.respond())
fd.close()
# ---------------------------------------------------------
# CSV file (for spreadsheet)
csv_file = '%s.txt' % fibasic.scan_id
fd = open('/'.join([TMPDIR, csv_file]), 'w')
示例8: Template
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [as 别名]
img_file = SCAN_HOME + '/%s.png' % (queue.scan_id)
plot.savefig(img_file)
# ---------------------------------------------------------
# HTML Webpage
TMPL_FILE = '/'.join([SCAN_HOME, 'forxf.html'])
html = Template(file=TMPL_FILE)
html.no_results = False
if len(high) == 0 and len(medium) == 0 and len(low) == 0:
html.no_results = True
else:
html.img = '.'.join([str(queue.scan_id), 'png'])
html.host = queue.hostname
html.high = high
html.medium = medium
html.low = low
page_file = '%s.html' % queue.scan_id
fd = open('/'.join([SCAN_HOME, page_file]), 'w')
fd.write(html.respond())
fd.close()
# PDF
PDF_TMPL = '/'.join([SCAN_HOME, 'forxf-pdf.html'])
pdf_html = Template(file=PDF_TMPL)
示例9: Template
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import host [as 别名]
match = re.search(p, line)
if match:
if server.upper() in line.upper():
u, d = match.groups()
urls.append(u)
desc.append(d)
os.chdir(cwd)
html = Template(file="../scan-results.html")
html.vulnerabilities = vulnerability_objects
html.no_results = False
if len(urls) > 0 and len(desc) > 0:
html.no_info = False
html.urls = urls
html.desc = desc
html.host = HOST
print "Content-type: text/html\n"
print html
else:
cursor.close()
database.close()
os.chdir(cwd)
html = Template(file="../scan-results.html")
html.no_results = True
html.no_info = True
html.host = HOST
print "Content-type: text/html\n"
print html