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


Python Template.shares方法代码示例

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


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

示例1: infopage

# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import shares [as 别名]
    def infopage(self):
        self.send_response(200)
        self.send_header('Content-type', 'text/html')
        self.end_headers()
        t = Template(file=os.path.join(SCRIPTDIR, 'templates',
                                       'info_page.tmpl'))
        t.admin = ''
        for section, settings in config.getShares():
            if 'type' in settings and settings['type'] == 'admin':
                t.admin += '<a href="/TiVoConnect?Command=Admin&Container=' + section\
                           + '">pyTivo Web Configuration</a><br>'\
                           + '<a href="/TiVoConnect?Command=NPL&Container=' + section\
                           + '">pyTivo ToGo</a><br>'
        if t.admin == '':
            t.admin = '<br><b>No Admin plugin installed in pyTivo.conf</b><br> If you wish to use'\
                      + ' the admin plugin add the following lines to pyTivo.conf<br><br>'\
                      + '[Admin]<br>type=admin'

        t.shares = 'Video shares:<br/>'
        for section, settings in config.getShares():
            if settings.get('type') == 'video':
                t.shares += '<a href="TiVoConnect?Command=QueryContainer&Container=' + section\
                    + '">' +  section + '</a><br/>'
        
        self.wfile.write(t)
        self.end_headers()
开发者ID:armooo,项目名称:pytivo,代码行数:28,代码来源:httpserver.py

示例2: infopage

# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import shares [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 shares [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


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