comparison src/core/sat_main.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 7d640c303140
children f8a8434dbac7
comparison
equal deleted inserted replaced
1233:0b87d029f0a3 1234:9c17bd37e6e5
93 self.bridge.register("getLastResource", self.memory._getLastResource) 93 self.bridge.register("getLastResource", self.memory._getLastResource)
94 self.bridge.register("getPresenceStatuses", self.memory._getPresenceStatuses) 94 self.bridge.register("getPresenceStatuses", self.memory._getPresenceStatuses)
95 self.bridge.register("getWaitingSub", self.memory.getWaitingSub) 95 self.bridge.register("getWaitingSub", self.memory.getWaitingSub)
96 self.bridge.register("getWaitingConf", self.getWaitingConf) 96 self.bridge.register("getWaitingConf", self.getWaitingConf)
97 self.bridge.register("sendMessage", self._sendMessage) 97 self.bridge.register("sendMessage", self._sendMessage)
98 self.bridge.register("getConfig", self.memory.getConfig) 98 self.bridge.register("getConfig", self._getConfig)
99 self.bridge.register("setParam", self.setParam) 99 self.bridge.register("setParam", self.setParam)
100 self.bridge.register("getParamA", self.memory.getStringParamA) 100 self.bridge.register("getParamA", self.memory.getStringParamA)
101 self.bridge.register("asyncGetParamA", self.memory.asyncGetStringParamA) 101 self.bridge.register("asyncGetParamA", self.memory.asyncGetStringParamA)
102 self.bridge.register("getParamsUI", self.memory.getParamsUI) 102 self.bridge.register("getParamsUI", self.memory.getParamsUI)
103 self.bridge.register("getParams", self.memory.getParams) 103 self.bridge.register("getParams", self.memory.getParams)
394 return self.profiles.values() 394 return self.profiles.values()
395 if profile.count('@') > 1: 395 if profile.count('@') > 1:
396 raise exceptions.ProfileKeyUnknownError 396 raise exceptions.ProfileKeyUnknownError
397 return [self.profiles[profile]] 397 return [self.profiles[profile]]
398 398
399 def _getConfig(self, section, name):
400 """Get the main configuration option
401
402 @param section: section of the config file (None or '' for DEFAULT)
403 @param name: name of the option
404 @return: unicode representation of the option
405 """
406 return unicode(self.memory.getConfig(section, name, ''))
407
399 ## Client management ## 408 ## Client management ##
400 409
401 def setParam(self, name, value, category, security_limit, profile_key): 410 def setParam(self, name, value, category, security_limit, profile_key):
402 """set wanted paramater and notice observers""" 411 """set wanted paramater and notice observers"""
403 self.memory.setParam(name, value, category, security_limit, profile_key) 412 self.memory.setParam(name, value, category, security_limit, profile_key)