当前位置: 首页>>代码示例>>Python>>正文


Python Template.workdir方法代码示例

本文整理汇总了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))
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:9,代码来源:start.py

示例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))
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:14,代码来源:start.py

示例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))
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:14,代码来源:start.py

示例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))
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:14,代码来源:start.py

示例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))
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:17,代码来源:start.py

示例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))
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:19,代码来源:start.py

示例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))
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:20,代码来源:start.py


注:本文中的Cheetah.Template.Template.workdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。