comparison src/plugins/plugin_tmp_demo_directory.py @ 1234:9c17bd37e6e5

core: better management of default value in getConfig
author Goffi <goffi@goffi.org>
date Tue, 07 Oct 2014 17:12:41 +0200
parents 301b342c697a
children 069ad98b360d
comparison
equal deleted inserted replaced
1233:0b87d029f0a3 1234:9c17bd37e6e5
74 'sub_label': _(PARAM_NAME_SUB[1]), 74 'sub_label': _(PARAM_NAME_SUB[1]),
75 } 75 }
76 76
77 def __init__(self, host): 77 def __init__(self, host):
78 log.info(_(u"Plugin demo directory initialization")) 78 log.info(_(u"Plugin demo directory initialization"))
79 activate = host.memory.getConfig(CONFIG_SECTION, CONFIG_ACTIVATE) or 'false' 79 activate = host.memory.getConfig(CONFIG_SECTION, CONFIG_ACTIVATE, 'false')
80 if not activate.lower() in ('true', 'yes', '1'): 80 if not activate.lower() in ('true', 'yes', '1'):
81 log.info("not activated") 81 log.info("not activated")
82 return 82 return
83 service_str = host.memory.getConfig(CONFIG_SECTION, CONFIG_SERVICE) or 'salut.libervia.org' 83 service_str = host.memory.getConfig(CONFIG_SECTION, CONFIG_SERVICE, 'salut.libervia.org')
84 self.service = jid.JID(service_str) 84 self.service = jid.JID(service_str)
85 self.host = host 85 self.host = host
86 host.memory.updateParams(self.params) 86 host.memory.updateParams(self.params)
87 host.trigger.add("paramUpdateTrigger", self.paramUpdateTrigger) 87 host.trigger.add("paramUpdateTrigger", self.paramUpdateTrigger)
88 88