api: permissive => forcepermissive

api: add permissive object
test api: permissive
config: unwrap_from_path check properties for option, not only optiondescription
option: _RegexpOption => RegexpOption
This commit is contained in:
2017-11-03 21:52:13 +01:00
parent 39348a14aa
commit 2e412b64fd
16 changed files with 1073 additions and 986 deletions

View File

@ -358,11 +358,10 @@ class OptionDescriptionWalk(CacheOptionDescription):
for child in self._impl_st_getchildren(context):
cname = child.impl_getname()
if dyn and child.impl_is_dynoptiondescription():
path = cname
for value in child._impl_get_suffixes(context):
yield SynDynOptionDescription(child,
cname + value,
path + value, value)
value)
else:
yield child
@ -383,17 +382,16 @@ class OptionDescriptionWalk(CacheOptionDescription):
for child in self._impl_st_getchildren(context, only_dyn=True):
cname = child.impl_getname()
if name.startswith(cname):
path = cname
for value in child._impl_get_suffixes(context):
if name == cname + value:
return SynDynOptionDescription(child, name, path + value, value)
return SynDynOptionDescription(child, name, value)
return ret
def _impl_get_dynchild(self, child, suffix):
name = child.impl_getname() + suffix
path = self.impl_getname() + suffix + '.' + name
if isinstance(child, OptionDescription):
return SynDynOptionDescription(child, name, path, suffix)
return SynDynOptionDescription(child, name, suffix)
else:
return child._impl_to_dyn(name, path)
@ -524,12 +522,11 @@ class DynOptionDescription(OptionDescription):
class SynDynOptionDescription(object):
__slots__ = ('_opt', '_name', '_path', '_suffix')
__slots__ = ('_opt', '_name', '_suffix')
def __init__(self, opt, name, path, suffix):
def __init__(self, opt, name, suffix):
self._opt = opt
self._name = name
self._path = path
self._suffix = suffix
def __getattr__(self, name, context=undefined):
@ -549,7 +546,10 @@ class SynDynOptionDescription(object):
return self._impl_getchildren()
def impl_getpath(self, context):
return self._path
path = self._impl_getopt().impl_getpath(context).split('.')
path[-1] += self._suffix
path.append(self._name)
return '.'.join(path)
def impl_getpaths(self, include_groups=False, _currpath=None):
return _impl_getpaths(self, include_groups, _currpath)
@ -825,12 +825,13 @@ class MasterSlaves(OptionDescription):
" which has {1} as master").format(
name, opt.impl_getname()))
def reset_cache(self, opt, values, type_, orig_opts):
path = self.getmaster(opt).impl_getpath(values._getcontext())
values._p_.delcache(path)
for slave in self.getslaves(opt):
slave_path = slave.impl_getpath(values._getcontext())
values._p_.delcache(slave_path)
def reset_cache(self, opt, obj, type_, resetted_opts):
context = obj._getcontext()
#FIXME pb avec dyn, devrait etre une option
mopt = self.getmaster(None)
mopt.reset_cache(mopt, obj, type_, resetted_opts)
for slave in self.getslaves(mopt):
slave.reset_cache(slave, obj, type_, resetted_opts)
def _getattr(self, name, suffix=undefined, context=undefined, dyn=True):
return super(MasterSlaves, self)._getattr(name, suffix, context, dyn)