build cache builds correctly now
authorgwen <gremond@cadoles.com>
Wed, 27 Mar 2013 16:01:20 +0000 (17:01 +0100)
committergwen <gremond@cadoles.com>
Wed, 27 Mar 2013 16:01:20 +0000 (17:01 +0100)
tiramisu/config.py
tiramisu/option.py
tiramisu/value.py

index d12cc41..469e198 100644 (file)
@@ -81,9 +81,7 @@ class Config(object):
             self._cfgimpl_build_all_paths()
 
     def _cfgimpl_build_all_paths(self):
-#        if self._cfgimpl_all_paths == None:
-#            raise ConfigError('cache paths must not be None')
-        self._cfgimpl_descr.build_cache()  #self._cfgimpl_all_paths)
+        self._cfgimpl_descr.build_cache()
 
     def cfgimpl_get_settings(self):
         return self._cfgimpl_context._cfgimpl_settings
index b6ad73d..9ed8aed 100644 (file)
@@ -475,22 +475,23 @@ class OptionDescription(BaseType, BaseInformation):
                 paths.append('.'.join(currpath + [attr]))
         return paths
 
-    def build_cache(self, currpath=None):
+    def build_cache(self, cache=None, currpath=None):
         if currpath is None and self._cache_paths != {}:
             return
         if currpath is None:
             currpath = []
+        if cache is None:
+            cache = self._cache_paths
         for option in self._children:
             attr = option._name
             if attr.startswith('_cfgimpl'):
                 continue
             if isinstance(option, OptionDescription):
                 currpath.append(attr)
-                option.build_cache(currpath=currpath)
+                option.build_cache(cache, currpath)
                 currpath.pop()
             else:
-                self._cache_paths[option] = str('.'.join(currpath + [attr]))
-
+                cache[option] = str('.'.join(currpath + [attr]))
     # ____________________________________________________________
     def set_group_type(self, group_type):
         """sets a given group object to an OptionDescription
index 4ebc073..d1ddbc8 100644 (file)
@@ -61,7 +61,7 @@ class Values(object):
                 value = opt.getdefault()
 
             if opt in self.slaves:
-                masterpath = self.context._cfgimpl_all_paths[self.slaves[opt]]
+                masterpath = self.context._cfgimpl_descr._cache_paths[self.slaves[opt]]
                 mastervalue = getattr(self.context, masterpath)
                 masterlen = len(mastervalue)
                 if len(value) < masterlen: