Просмотр исходного кода

Sauvegarde de la configuration lors de modifications

prieto 9 лет назад
Родитель
Сommit
25b5f32061
1 измененных файлов: 8 добавлений и 3 удалений
  1. 8
    3
      lodel/settings/settings.py

+ 8
- 3
lodel/settings/settings.py Просмотреть файл

@@ -115,9 +115,14 @@ class Settings(object, metaclass=MetaSettings):
115 115
             if cls.started():
116 116
                 raise RuntimeError("The Settings class is allready started")
117 117
 
118
+    ##@brief Saves a new configutration for section confname
119
+    #@param confname is the name of the modified section
120
+    #@param confvalue is a dict with variables to save
121
+    #@param validators is a dict with adapted validator
118 122
     @classmethod
119
-    def set(cls, confname, confvalue):
120
-        pass
123
+    def set(cls, confname, confvalue,loader):
124
+        for key in confvalue:
125
+            loader.setoption(confname, key, confvalue[key], validators[key])
121 126
 
122 127
     ##@brief This method handlers Settings instance bootstraping
123 128
     def __bootstrap(self):
@@ -182,7 +187,7 @@ class Settings(object, metaclass=MetaSettings):
182 187
                     res[section.lower()][kname] = copy.copy(spec[section][kname])
183 188
         return res
184 189
     
185
-    ##@brief Populate the Settings instance with options values fecthed with the loader from merged specs
190
+    ##@brief Populate the Settings instance with options values fetched with the loader from merged specs
186 191
     #
187 192
     # Populate the __confs attribute
188 193
     # @param specs dict : Settings specification dictionnary as returned by __merge_specs

Загрузка…
Отмена
Сохранить