Browse Source

Merge branch 'newlodel' of git.labocleo.org:lodel2 into newlodel

Yann Weber 9 years ago
parent
commit
7ef1bd8a2f
2 changed files with 23 additions and 15 deletions
  1. 9
    1
      lodel/editorial_model/components.py
  2. 14
    14
      lodel/settings/settings_loader.py

+ 9
- 1
lodel/editorial_model/components.py View File

@@ -176,7 +176,15 @@ class EmField(EmComponent):
176 176
         ## @brief Stores the emclass that contains this field (set by EmClass.add_field() method)
177 177
         self._emclass = None
178 178
 
179
-    ## @warning Not complete !
179
+    ## @brief Returns data_handler_name attribute
180
+    def get_data_handler_name(self):
181
+        return copy.copy(self.data_handler_name)
182
+        
183
+    ## @brief Returns data_handler_cls attribute
184
+    def get_data_handler_cls(self):
185
+        return copy.copy(selfdata_handler_cls)
186
+    
187
+    # @warning Not complete !
180 188
     # @todo Complete the hash when data handlers becomes available
181 189
     def d_hash(self):
182 190
         return int.from_bytes(hashlib.md5(

+ 14
- 14
lodel/settings/settings_loader.py View File

@@ -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
         

Loading…
Cancel
Save