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


Python Template.togo方法代码示例

本文整理汇总了Python中Cheetah.Template.Template.togo方法的典型用法代码示例。如果您正苦于以下问题:Python Template.togo方法的具体用法?Python Template.togo怎么用?Python Template.togo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cheetah.Template.Template的用法示例。


在下文中一共展示了Template.togo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: infopage

# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import togo [as 别名]
    def infopage(self):
        t = Template(file=os.path.join(SCRIPTDIR, 'templates',
                                       'info_page.tmpl'),
                     filter=EncodeUnicode)
        t.admin = ''

        if config.get_server('tivo_mak') and config.get_server('togo_path'):
            t.togo = '<br>Pull from TiVos:<br>'
        else:
            t.togo = ''

        for section, settings in config.getShares():
            plugin_type = settings.get('type')
            if plugin_type == 'settings':
                t.admin += ('<a href="/TiVoConnect?Command=Settings&amp;' +
                            'Container=' + quote(section) +
                            '">Settings</a><br>')
            elif plugin_type == 'togo' and t.togo:
                for tsn in config.tivos:
                    if tsn and 'address' in config.tivos[tsn]:
                        t.togo += ('<a href="/TiVoConnect?' +
                            'Command=NPL&amp;Container=' + quote(section) +  
                            '&amp;TiVo=' + config.tivos[tsn]['address'] +
                            '">' + config.tivos[tsn]['name'] +
                            '</a><br>')

        self.send_html(str(t))
开发者ID:wmcbrine,项目名称:pytivo,代码行数:29,代码来源:httpserver.py

示例2: infopage

# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import togo [as 别名]
    def infopage(self):
        useragent = self.headers.getheader('User-Agent', '')
        if useragent.lower().find('mobile') > 0:
            t = Template(file=os.path.join(SCRIPTDIR, 'templates',
                                       'info_page_mob.tmpl'),
                     filter=EncodeUnicode)
        else:
            t = Template(file=os.path.join(SCRIPTDIR, 'templates',
                                       'info_page.tmpl'),
                     filter=EncodeUnicode)
        t.admin = ''

        if config.get_server('tivo_mak') and config.get_server('togo_path'):
            t.togo = '<br>Pull from TiVos:<br>'
        else:
            t.togo = ''

        if (config.get_server('tivo_username') and
            config.get_server('tivo_password')):
            t.shares = '<br>Push from video shares:<br>'
        else:
            t.shares = ''

        for section, settings in config.getShares():
            plugin_type = settings.get('type')
            if plugin_type == 'settings':
                t.admin += ('<a href="/TiVoConnect?Command=Settings&amp;' +
                            'Container=' + quote(section) +
                            '">Settings</a><br>')
            elif plugin_type == 'togo' and t.togo:
                for tsn in config.tivos:
                    if tsn:
                        t.togo += ('<a href="/TiVoConnect?' +
                            'Command=NPL&amp;Container=' + quote(section) +  
                            '&amp;TiVo=' + config.tivos[tsn] + '">' + 
                            escape(config.tivo_names[tsn]) + '</a><br>')
            elif plugin_type and t.shares:
                plugin = GetPlugin(plugin_type)
                if hasattr(plugin, 'Push'):
                    t.shares += ('<a href="/TiVoConnect?Command=' +
                                 'QueryContainer&amp;Container=' +
                                 quote(section) + '&Format=text/html">' +
                                 section + '</a><br>')

        self.send_html(str(t))
开发者ID:wynneth,项目名称:pytivo,代码行数:47,代码来源:httpserver.py

示例3: infopage

# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import togo [as 别名]
    def infopage(self):
        self.send_response(200)
        self.send_header('Content-type', 'text/html; charset=utf-8')
        self.end_headers()
        t = Template(file=os.path.join(SCRIPTDIR, 'templates',
                                       'info_page.tmpl'),
                     filter=EncodeUnicode)
        t.admin = ''

        if config.get_server('tivo_mak') and config.get_server('togo_path'):
            t.togo = '<br>Pull from TiVos:<br>'
        else:
            t.togo = ''

        if (config.get_server('tivo_username') and
            config.get_server('tivo_password')):
            t.shares = '<br>Push from video shares:<br>'
        else:
            t.shares = ''

        for section, settings in config.getShares():
            plugin_type = settings.get('type')
            if plugin_type == 'settings':
                t.admin += ('<a href="/TiVoConnect?Command=Settings&amp;' +
                            'Container=' + quote(section) +
                            '">Web Configuration</a><br>')
            elif plugin_type == 'togo' and t.togo:
                for tsn in config.tivos:
                    if tsn:
                        t.togo += ('<a href="/TiVoConnect?' +
                            'Command=NPL&amp;Container=' + quote(section) +  
                            '&amp;TiVo=' + config.tivos[tsn] + '">' + 
                            escape(config.tivo_names[tsn]) + '</a><br>')
            elif plugin_type == 'video' and t.shares:
                t.shares += ('<a href="TiVoConnect?Command=' +
                             'QueryContainer&amp;Container=' +
                             quote(section) + '&Format=text/html">' +
                             section + '</a><br>')

        self.wfile.write(t)
开发者ID:william40,项目名称:pytivo,代码行数:42,代码来源:httpserver.py

示例4: infopage

# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import togo [as 别名]
    def infopage(self):
        t = Template(file=os.path.join(SCRIPTDIR, 'templates', 'info_page.tmpl'))
        t.version = PYTIVO_VERSION
        t.admin = ''

        if config.get_server('tivo_mak') and config.get_togo('path'):
            t.togo = '<br>Pull from TiVos:<br>'
        else:
            t.togo = ''

        for section, settings in config.getShares():
            plugin_type = settings.get('type')
            if plugin_type == 'settings':
                t.admin += ('<a href="/TiVoConnect?Command=Settings&amp;Container={}">Settings</a><br>'
                            .format(quote(section)))
            elif plugin_type == 'togo' and t.togo:
                for tsn in config.tivos:
                    if tsn and 'address' in config.tivos[tsn]:
                        t.togo += ('<a href="/TiVoConnect?Command=NPL&amp;Container={}&amp;TiVo={}">{}</a><br>'
                                   .format(quote(section), config.tivos[tsn]['address'], config.tivos[tsn]['name']))

        self.send_html(str(t))
开发者ID:mlippert,项目名称:pytivo,代码行数:24,代码来源:httpserver.py


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