core (memory, config): moved parseMainConf to tools/config so it can be used by frontends too
This commit is contained in:
parent
9de26f66ea
commit
8403bd61ae
1 changed files with 10 additions and 11 deletions
|
|
@ -43,7 +43,7 @@ def fixConfigOption(section, option, value, silent=True):
|
|||
@param value (str): the new value
|
||||
@param silent (boolean): toggle logging output (must be True when called from sat.sh)
|
||||
"""
|
||||
config = SafeConfigParser()
|
||||
config = SafeConfigParser(defaults=C.DEFAULT_CONFIG)
|
||||
target_file = None
|
||||
for file_ in C.CONFIG_FILES[::-1]:
|
||||
# we will eventually update the existing file with the highest priority, if it's a user personal file...
|
||||
|
|
@ -68,6 +68,14 @@ def fixConfigOption(section, option, value, silent=True):
|
|||
log.warning(_(u"Config auto-update: %(option)s set to %(value)s in the file %(config_file)s") %
|
||||
{'option': option, 'value': value, 'config_file': target_file})
|
||||
|
||||
def parseMainConf():
|
||||
"""look for main .ini configuration file, and parse it"""
|
||||
config = SafeConfigParser(defaults=C.DEFAULT_CONFIG)
|
||||
try:
|
||||
config.read(C.CONFIG_FILES)
|
||||
except:
|
||||
log.error(_("Can't read main config !"))
|
||||
return config
|
||||
|
||||
def getConfig(config, section, name, default=None):
|
||||
"""Get a configuration option
|
||||
|
|
|
|||
Loading…
Reference in a new issue