|
@@ -25,25 +25,25 @@ class SettingsLoader(object):
|
25
|
25
|
conf = dict()
|
26
|
26
|
dir_conf = os.open(self.__conf_path, os.O_RDONLY)
|
27
|
27
|
|
28
|
|
- l = glob.glob(self.__conf_path+'/*.ini')
|
|
28
|
+ l_dir = glob.glob(self.__conf_path+'/*.ini')
|
29
|
29
|
|
30
|
|
- for f in l:
|
|
30
|
+ for f_ini in l_dir:
|
31
|
31
|
config = configparser.ConfigParser(default_section = 'lodel2')
|
32
|
|
- config.read(f)
|
33
|
|
- for s in config:
|
34
|
|
- if s in conf:
|
35
|
|
- for vs in config[s]:
|
36
|
|
- if vs not in conf[s]:
|
37
|
|
- conf[s][vs] = config[s][vs]
|
38
|
|
- if s != 'DEFAULT': self.__conf_sv.add(s + ':' + vs)
|
|
32
|
+ config.read(f_ini)
|
|
33
|
+ for sect in config:
|
|
34
|
+ if sect in conf:
|
|
35
|
+ for param in config[sect]:
|
|
36
|
+ if param not in conf[sect]:
|
|
37
|
+ conf[sect][param] = config[sect][param]
|
|
38
|
+ if sect != 'DEFAULT': self.__conf_sv.add(sect + ':' + param)
|
39
|
39
|
else:
|
40
|
|
- raise SettingsError("Key attribute already define : %s" % s + ' '+vs)
|
|
40
|
+ raise SettingsError("Key attribute already define : %s" % sect + ' '+param)
|
41
|
41
|
else:
|
42
|
42
|
opts={}
|
43
|
|
- for key in config[s]:
|
44
|
|
- opts[key] = config[s].get(key)
|
45
|
|
- if s != 'DEFAULT': self.__conf_sv.add(s + ':' + key)
|
46
|
|
- conf.update({s: opts})
|
|
43
|
+ for key in config[sect]:
|
|
44
|
+ opts[key] = config[sect].get(key)
|
|
45
|
+ if sect != 'DEFAULT': self.__conf_sv.add(sect + ':' + key)
|
|
46
|
+ conf.update({sect: opts})
|
47
|
47
|
os.close(dir_conf)
|
48
|
48
|
return conf
|
49
|
49
|
|