build cache builds correctly now

This commit is contained in:
gwen 2013-03-27 17:01:20 +01:00
parent 201f9d6db4
commit 8181d1b596
3 changed files with 7 additions and 8 deletions

View 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

View 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

View 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: