core: better management of default value in getConfig
This commit is contained in:
parent
97630ccab9
commit
6b20989ecc
2 changed files with 21 additions and 11 deletions
|
|
@ -151,7 +151,7 @@ class MiscAccount(object):
|
|||
self.__delete_account_id = host.registerCallback(self.__deleteAccountCb, with_data=True)
|
||||
|
||||
def getConfig(self, name):
|
||||
return self.host.memory.getConfig(CONFIG_SECTION, name) or default_conf[name]
|
||||
return self.host.memory.getConfig(CONFIG_SECTION, name, default_conf[name])
|
||||
|
||||
def _registerAccount(self, email, password, profile):
|
||||
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@ class DemoDirectory(object):
|
|||
|
||||
def __init__(self, host):
|
||||
log.info(_(u"Plugin demo directory initialization"))
|
||||
activate = host.memory.getConfig(CONFIG_SECTION, CONFIG_ACTIVATE) or 'false'
|
||||
activate = host.memory.getConfig(CONFIG_SECTION, CONFIG_ACTIVATE, 'false')
|
||||
if not activate.lower() in ('true', 'yes', '1'):
|
||||
log.info("not activated")
|
||||
return
|
||||
service_str = host.memory.getConfig(CONFIG_SECTION, CONFIG_SERVICE) or 'salut.libervia.org'
|
||||
service_str = host.memory.getConfig(CONFIG_SECTION, CONFIG_SERVICE, 'salut.libervia.org')
|
||||
self.service = jid.JID(service_str)
|
||||
self.host = host
|
||||
host.memory.updateParams(self.params)
|
||||
|
|
|
|||
Loading…
Reference in a new issue