本文整理汇总了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&' +
'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&Container=' + quote(section) +
'&TiVo=' + config.tivos[tsn]['address'] +
'">' + config.tivos[tsn]['name'] +
'</a><br>')
self.send_html(str(t))
示例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&' +
'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&Container=' + quote(section) +
'&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&Container=' +
quote(section) + '&Format=text/html">' +
section + '</a><br>')
self.send_html(str(t))
示例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&' +
'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&Container=' + quote(section) +
'&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&Container=' +
quote(section) + '&Format=text/html">' +
section + '</a><br>')
self.wfile.write(t)
示例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&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&Container={}&TiVo={}">{}</a><br>'
.format(quote(section), config.tivos[tsn]['address'], config.tivos[tsn]['name']))
self.send_html(str(t))