Mercurial > libervia-backend
comparison src/memory/memory.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 | f0c9b149ed99 |
children | 22adf1eb59f5 |
comparison
equal
deleted
inserted
replaced
1233:0b87d029f0a3 | 1234:9c17bd37e6e5 |
---|---|
224 config.read(C.CONFIG_FILES) | 224 config.read(C.CONFIG_FILES) |
225 except: | 225 except: |
226 log.error(_("Can't read main config !")) | 226 log.error(_("Can't read main config !")) |
227 return config | 227 return config |
228 | 228 |
229 def getConfig(self, section, name): | 229 def getConfig(self, section, name, default=None): |
230 """Get the main configuration option | 230 """Get the main configuration option |
231 | |
231 @param section: section of the config file (None or '' for DEFAULT) | 232 @param section: section of the config file (None or '' for DEFAULT) |
232 @param name: name of the option | 233 @param name: name of the option |
233 """ | 234 @param default: value to use if not found |
234 return tools_config.getConfig(self.config, section, name, default='') | 235 @return: str, list or dict |
236 """ | |
237 return tools_config.getConfig(self.config, section, name, default) | |
235 | 238 |
236 def load_xml(self, filename): | 239 def load_xml(self, filename): |
237 """Load parameters template from xml file | 240 """Load parameters template from xml file |
238 | 241 |
239 @param filename (str): input file | 242 @param filename (str): input file |