本文整理汇总了Python中Components.config.ConfigSubsection.setSavedValue方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigSubsection.setSavedValue方法的具体用法?Python ConfigSubsection.setSavedValue怎么用?Python ConfigSubsection.setSavedValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.config.ConfigSubsection
的用法示例。
在下文中一共展示了ConfigSubsection.setSavedValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: saveconfig
# 需要导入模块: from Components.config import ConfigSubsection [as 别名]
# 或者: from Components.config.ConfigSubsection import setSavedValue [as 别名]
def saveconfig(self):
nim_config_list = []
if self.initial_state != config.clientmode.enabled.value and self.initial_state == False: # switching to client mode
# save normal mode config so it can be reinsated when returning to normal mode
nim_config_list = []
for x in config.Nims:
nim_config_list.append(x.getSavedValue())
import json
config.clientmode.nim_cache.value = json.dumps(nim_config_list)
config.clientmode.remote_fallback_enabled_cache.value = config.usage.remote_fallback_enabled.value
config.clientmode.remote_fallback_cache.value = config.usage.remote_fallback.value
# normal mode config values saved
if config.clientmode.enabled.value:
config.usage.remote_fallback_enabled.value = True
config.usage.remote_fallback.value = "http://%s:%d" % (self.getRemoteAddress(), config.clientmode.serverStreamingPort.value)
elif self.initial_state != config.clientmode.enabled.value: # switching back to normal mode
# load nim config from config.clientmode.nimcache
import json
nim_config_list = json.loads(config.clientmode.nim_cache.value)
config.clientmode.nim_cache.value = ""
config.Nims = ConfigSubList()
for x in nim_config_list:
tuner = ConfigSubsection()
tuner.setSavedValue(x)
config.Nims.append(tuner)
config.Nims.save()
# nim config loaded... but needs restart
# reinstate normal mode values
config.usage.remote_fallback_enabled.value = config.clientmode.remote_fallback_enabled_cache.value
config.usage.remote_fallback.value = config.clientmode.remote_fallback_cache.value
# reset some client mode settings
config.clientmode.remote_fallback_enabled_cache.value = False
config.clientmode.remote_fallback_cache.value = ""
config.usage.save()
config.clientmode.save()
configfile.save()