本文整理汇总了Python中Cheetah.Template.Template.tivos_data方法的典型用法代码示例。如果您正苦于以下问题:Python Template.tivos_data方法的具体用法?Python Template.tivos_data怎么用?Python Template.tivos_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cheetah.Template.Template
的用法示例。
在下文中一共展示了Template.tivos_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Settings
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import tivos_data [as 别名]
def Settings(self, handler, query):
# Read config file new each time in case there was any outside edits
config.reset()
shares_data = []
for section in config.config.sections():
if not section.startswith(('_tivo_', 'Server')):
if (not (config.config.has_option(section, 'type')) or
config.config.get(section, 'type').lower() not in
['settings', 'togo']):
shares_data.append((section,
dict(config.config.items(section,
raw=True))))
t = Template(SETTINGS_TEMPLATE, filter=EncodeUnicode)
t.mode = buildhelp.mode
t.options = buildhelp.options
t.container = handler.cname
t.quote = quote
t.server_data = dict(config.config.items('Server', raw=True))
t.server_known = buildhelp.getknown('server')
t.hd_tivos_data = dict(config.config.items('_tivo_HD', raw=True))
t.hd_tivos_known = buildhelp.getknown('hd_tivos')
t.sd_tivos_data = dict(config.config.items('_tivo_SD', raw=True))
t.sd_tivos_known = buildhelp.getknown('sd_tivos')
t.shares_data = shares_data
t.shares_known = buildhelp.getknown('shares')
t.tivos_data = [(section, dict(config.config.items(section, raw=True)))
for section in config.config.sections()
if section.startswith('_tivo_')
and not section.startswith(('_tivo_SD', '_tivo_HD'))]
t.tivos_known = buildhelp.getknown('tivos')
t.help_list = buildhelp.gethelp()
t.has_shutdown = hasattr(handler.server, 'shutdown')
handler.send_html(str(t))
示例2: Admin
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import tivos_data [as 别名]
def Admin(self, handler, query):
#Read config file new each time in case there was any outside edits
config = ConfigParser.ConfigParser()
config.read(config_file_path)
shares_data = []
for section in config.sections():
if not(section.startswith('_tivo_') or section.startswith('Server')):
if not(config.has_option(section,'type')):
shares_data.append((section, dict(config.items(section, raw=True))))
elif config.get(section,'type').lower() != 'admin':
shares_data.append((section, dict(config.items(section, raw=True))))
subcname = query['Container'][0]
cname = subcname.split('/')[0]
handler.send_response(200)
handler.end_headers()
t = Template(file=os.path.join(SCRIPTDIR,'templates', 'settings.tmpl'))
t.container = cname
t.server_data = dict(config.items('Server', raw=True))
t.server_known = buildhelp.getknown('server')
t.shares_data = shares_data
t.shares_known = buildhelp.getknown('shares')
t.tivos_data = [ (section, dict(config.items(section, raw=True))) for section in config.sections() \
if section.startswith('_tivo_')]
t.tivos_known = buildhelp.getknown('tivos')
t.help_list = buildhelp.gethelp()
handler.wfile.write(t)
示例3: Settings
# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import tivos_data [as 别名]
def Settings(self, handler, query):
# Read config file new each time in case there was any outside edits
config.reset()
shares_data = []
for section in config.config.sections():
if not (section.startswith('_tivo_')
or section.startswith('Server')):
if (not (config.config.has_option(section, 'type')) or
config.config.get(section, 'type').lower() not in
['settings', 'togo']):
shares_data.append((section,
dict(config.config.items(section,
raw=True))))
cname = query['Container'][0].split('/')[0]
t = Template(SETTINGS_TEMPLATE, filter=EncodeUnicode)
t.container = cname
t.quote = quote
t.server_data = dict(config.config.items('Server', raw=True))
t.server_known = buildhelp.getknown('server')
if config.config.has_section('_tivo_HD'):
t.hd_tivos_data = dict(config.config.items('_tivo_HD', raw=True))
else:
t.hd_tivos_data = {}
t.hd_tivos_known = buildhelp.getknown('hd_tivos')
if config.config.has_section('_tivo_SD'):
t.sd_tivos_data = dict(config.config.items('_tivo_SD', raw=True))
else:
t.sd_tivos_data = {}
t.sd_tivos_known = buildhelp.getknown('sd_tivos')
t.shares_data = shares_data
t.shares_known = buildhelp.getknown('shares')
t.tivos_data = [(section, dict(config.config.items(section, raw=True)))
for section in config.config.sections()
if section.startswith('_tivo_')
and not section.startswith('_tivo_SD')
and not section.startswith('_tivo_HD')]
t.tivos_known = buildhelp.getknown('tivos')
t.help_list = buildhelp.gethelp()
t.has_shutdown = hasattr(handler.server, 'shutdown')
handler.send_response(200)
handler.send_header('Content-Type', 'text/html; charset=utf-8')
handler.send_header('Expires', '0')
handler.end_headers()
handler.wfile.write(t)