本文整理汇总了Python中Cheetah.Template.Template.title方法的典型用法代码示例。如果您正苦于以下问题:Python Template.title方法的具体用法?Python Template.title怎么用?Python Template.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cheetah.Template.Template
的用法示例。
在下文中一共展示了Template.title方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: multipartTestPage
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [as 别名]
def multipartTestPage(self):
omras_page = Template(file="./templates/omras-template.html")
omras_page.title = "Sonic Annotator Webapplication"
#content = main content within an omras page
content = Template(file="./templates/main-content.html")
content.title = "OMRAS2 Music Analysis and Feature Extraction Service"
#see if we have audio, hence if we need the id block...
if cherrypy.session.has_key('audio_file') :
#file_id_block = list of files uploaded so far
filelist = list(cherrypy.session['audio_file'])
file_id_block = Template(file="./templates/fileID-block.html")
file_id_block.section_title = "File Identification"
file_id_block.javascript_data = self.jsDataGenerator(filelist)
file_id_block.file_list = list(cherrypy.session['audio_file'])
content.file_id_block = str(file_id_block)
omras_page.on_load_script = """ window.location.hash="upload_file" """
else:
content.file_id_block = ''
omras_page.on_load_script = ''
vamp_transforms = self.sonic.getTransforms()
content.text = vamp_transforms.items()
content.transforms = vamp_transforms
content.sessionID = self.server.getSessionID()
omras_page.content = str(content)
count = cherrypy.session.get('count', 0) + 1
cherrypy.session['count'] = count
return str(omras_page)
示例2: show_error
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [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))
示例3: log
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [as 别名]
def log(self):
logcontent = open('SynoDLNAtrakt.log').read()
message = "<code>{0}</code>".format(logcontent)
filename = os.path.join(APPDIR, "data/logs.tmpl")
template = Template(file = filename)
template.title = "SynoDLNAtrakt Logs"
template.content = logcontent
return str(template)
示例4: write
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [as 别名]
def write(self, response):
t = Template(file='templates/page.tmpl')
if self._main and self._login.isLoggedIn():
t.body = self._main.write()
else:
t.body = WelcomeModule.WelcomeModule(self).write()
t.login = self._login.write()
t.title = self._title
response.write(str(t))
示例5: main_template
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [as 别名]
def main_template(title, content, modified, trail="", sidebar="", version=""):
main_template = Template(source=main)
main_template.title = title
main_template.text_content = content
main_template.last_modified = modified
main_template.trail = trail
main_template.sidebar = sidebar
main_template.version = version
return str(main_template)
示例6: index
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [as 别名]
def index(self):
t = Template(file="data/templates/index.tmpl")
conn = db.db(constants.DATABASE).getconnector()
c = conn.cursor()
c.execute("SELECT * FROM items;")
t.title = "Shop And Share"
t.rows = c.fetchall()
return str(t)
示例7: export
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [as 别名]
def export(self, fileName):
#export svg
#the list of layers requires a thin layer around the
#slices in the slice set, due to the transformations required
#for the fancy viewer
slices = self.sliceSet.slices;
logging.info("Exporting " + str(len(slices)) + " slices to file'" + fileName + "'...");
layers = []
for s in self.sliceSet.slices:
layers.append( SVGLayer(s,self.unitScale,self.NUMBERFORMAT) );
#use a cheetah template to populate the data
#unfortunately most numbers must be formatted to particular precision
#most values are redundant from sliceSet, but are repeated to allow
#different formatting without modifying underlying data
t = Template(file='svg_template.tmpl');
t.sliceSet = self.sliceSet;
t.layers = layers;
t.units=self.units;
t.unitScale = self.unitScale;
#adjust precision of the limits to 4 decimals
#this converts to a string, but that's ok since we're using it
# to populate a template
t.sliceHeight = self.NUMBERFORMAT % t.sliceSet.sliceHeight;
t.xMin = self.NUMBERFORMAT % t.sliceSet.analyzer.xMin;
t.xMax = self.NUMBERFORMAT % t.sliceSet.analyzer.xMax;
t.xRange = self.NUMBERFORMAT % t.sliceSet.analyzer.xDim;
t.yMin = self.NUMBERFORMAT % t.sliceSet.analyzer.yMin;
t.yMax = self.NUMBERFORMAT % t.sliceSet.analyzer.yMax;
t.yRange = self.NUMBERFORMAT % t.sliceSet.analyzer.yDim;
t.zMin = self.NUMBERFORMAT % t.sliceSet.analyzer.zMin;
t.zMax = self.NUMBERFORMAT % t.sliceSet.analyzer.zMax;
t.zRange = self.NUMBERFORMAT % t.sliceSet.analyzer.zDim;
#svg specific properties
t.xTranslate=(-1)*t.sliceSet.analyzer.xMin
t.yTranslate=(-1)*t.sliceSet.analyzer.yMin
t.title=self.title
t.desc=self.description
#put layer dims as nicely formatted numbers
t.xMinText = "%0.3f" % t.sliceSet.analyzer.xMin;
t.xMaxText = "%0.3f" % t.sliceSet.analyzer.xMax;
t.yMinText = "%0.3f" % t.sliceSet.analyzer.yMin;
t.yMaxText = "%0.3f" % t.sliceSet.analyzer.yMax;
t.zMinText = "%0.3f" % t.sliceSet.analyzer.zMin;
t.zMaxText = "%0.3f" % t.sliceSet.analyzer.zMax;
f = open(fileName,'w');
f.write(str(t));
f.close()
示例8: tmpl
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [as 别名]
def tmpl(req):
t= Template(file='/home/yuanzheng/Public/public_html/cs462/lab2/test.tmpl')
t.title="Recent Images"
t.body="this is text"
m = Template(file='/home/yuanzheng/Public/public_html/cs462/lab2/template.tmpl')
m.main = t.__str__()
req.content_type = "text/html"
req.write(m.__str__())
示例9: show_manager_log
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [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))
示例10: show_configure
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [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))
示例11: show_logfile
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [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))
示例12: show_instance_list
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [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))
示例13: show_statistics
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [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))
示例14: show_sensor_data
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [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))
示例15: do_GET
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import title [as 别名]
def do_GET(self):
path = self.translate_path(self.path)
if path and exists(path) and isfile(path):
self.copyfile(open(path), self.wfile)
else:
tmpl = Template(templateDef, filter=UnicodeFilter)
tmpl.title = 'Ledger Journal'
tmpl.posts = self.journal.collect(sys.argv[2])
tmpl.total = ledger.Value(0)
tmpl.strip = strip
tmpl.last_xact = None
tmpl.empty = ""
html = unicode(tmpl)
html = html.encode('utf-8')
self.wfile.write(html)