From 8181d1b5968f9b02c8f6696701bd26e2fce1b9bb Mon Sep 17 00:00:00 2001 From: gwen Date: Wed, 27 Mar 2013 17:01:20 +0100 Subject: [PATCH] build cache builds correctly now --- tiramisu/config.py | 4 +--- tiramisu/option.py | 9 +++++---- tiramisu/value.py | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tiramisu/config.py b/tiramisu/config.py index d12cc41..469e198 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -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 diff --git a/tiramisu/option.py b/tiramisu/option.py index b6ad73d..9ed8aed 100644 --- a/tiramisu/option.py +++ b/tiramisu/option.py @@ -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 diff --git a/tiramisu/value.py b/tiramisu/value.py index 4ebc073..d1ddbc8 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -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: