better reset_cache

This commit is contained in:
Emmanuel Garette 2018-04-03 21:15:58 +02:00
parent dc84608348
commit 13ec51f468
3 changed files with 19 additions and 27 deletions

View File

@ -92,24 +92,17 @@ class SubConfig(object):
opt,
path):
tresetted_opts = copy(resetted_opts)
opt.reset_cache(opt,
path,
values,
'values',
tresetted_opts)
tresetted_opts = copy(resetted_opts)
opt.reset_cache(opt,
path,
settings,
'settings',
tresetted_opts)
resetted_opts.extend(tresetted_opts)
resetted_opts)
for woption in opt._get_dependencies(self):
option = woption()
if option in resetted_opts:
continue
option_path = option.impl_getpath(self)
print(option_path, resetted_opts)
if option_path in resetted_opts:
continue
self.reset_one_option_cache(values,
settings,
resetted_opts,
@ -135,7 +128,7 @@ class SubConfig(object):
settings = context.cfgimpl_get_settings()
if not None in (opt, path):
if opt not in resetted_opts:
if path not in resetted_opts:
self.reset_one_option_cache(values,
settings,
resetted_opts,

View File

@ -498,17 +498,16 @@ class BaseOption(Base):
def reset_cache(self,
opt,
path,
obj,
type_,
values,
settings,
resetted_opts):
if opt in resetted_opts:
return
if not type_ == 'values' or not opt.impl_is_optiondescription():
if type_ != 'permissives':
obj._p_.delcache(path)
if type_ in ['settings', 'permissives']:
obj._pp_.delcache(path)
resetted_opts.append(opt)
settings._p_.delcache(path)
settings._pp_.delcache(path)
if not opt.impl_is_optiondescription():
values._p_.delcache(path)
resetted_opts.append(path)
def impl_is_symlinkoption(self):
return False

View File

@ -146,24 +146,24 @@ class MasterSlaves(OptionDescription):
def reset_cache(self,
opt,
path,
obj,
type_,
values,
settings,
resetted_opts):
context = obj._getcontext()
context = values._getcontext()
#FIXME pb avec dyn, devrait etre une option
mopt = self.getmaster()
mpath = mopt.impl_getpath(context)
mopt.reset_cache(mopt,
mpath,
obj,
type_,
values,
settings,
resetted_opts)
for slave in self.getslaves():
spath = slave.impl_getpath(context)
slave.reset_cache(slave,
spath,
obj,
type_,
values,
settings,
resetted_opts)
def impl_validate_value(self,