if impl_is_readonly is not False => duplicated option !

This commit is contained in:
Emmanuel Garette 2018-11-17 22:12:21 +01:00
parent c86cad227e
commit f86cbb1bcd
3 changed files with 6 additions and 7 deletions

View file

@ -483,6 +483,8 @@ class SubConfig(object):
fullpath, fullpath,
pathsvalues): pathsvalues):
if withoption is not None: if withoption is not None:
# Find all option with criteria
# retrieve OptionDescription and make_dict on it
mypath = self.cfgimpl_get_path() mypath = self.cfgimpl_get_path()
for path in context.find(bytype=None, for path in context.find(bytype=None,
byname=withoption, byname=withoption,

View file

@ -71,7 +71,7 @@ class MasterSlaves(OptionDescription):
'').format(self.impl_get_display_name(), '').format(self.impl_get_display_name(),
child.impl_get_display_name())) child.impl_get_display_name()))
if idx != 0 and child.impl_getdefault() != []: if idx != 0 and child.impl_getdefault() != []:
raise ValueError(_('not allowed default value for option "{0}" ' raise ValueError(_('not allowed default value for slave option "{0}" '
'in masterslaves "{1}"' 'in masterslaves "{1}"'
'').format(child.impl_get_display_name(), '').format(child.impl_get_display_name(),
self.impl_get_display_name())) self.impl_get_display_name()))

View file

@ -150,14 +150,11 @@ class CacheOptionDescription(BaseOption):
raise ValueError(_('malformed requirements option "{0}" ' raise ValueError(_('malformed requirements option "{0}" '
'must not be a multi for "{1}"').format( 'must not be a multi for "{1}"').format(
require_opt.impl_getname(), option.impl_getname())) require_opt.impl_getname(), option.impl_getname()))
if option.impl_is_readonly():
raise ConflictError(_('duplicate option: {0}').format(option))
option._path = subpath option._path = subpath
option._set_readonly() option._set_readonly()
if init: if init:
if __debug__ and len(cache_option) != len(set(cache_option)):
for idx in range(1, len(cache_option) + 1):
opt = cache_option.pop(0)
if opt in cache_option:
raise ConflictError(_('duplicate option: {0}').format(opt))
if _consistencies != {}: if _consistencies != {}:
self._cache_consistencies = {} self._cache_consistencies = {}
for weak_opt, cons in _consistencies.items(): for weak_opt, cons in _consistencies.items():
@ -168,7 +165,7 @@ class CacheOptionDescription(BaseOption):
opt.impl_getname())) opt.impl_getname()))
self._cache_consistencies[opt] = tuple(cons) self._cache_consistencies[opt] = tuple(cons)
self._cache_force_store_values = force_store_values self._cache_force_store_values = force_store_values
self._path = subpath self._path = self._name
self._set_readonly() self._set_readonly()
def impl_build_force_store_values(self, def impl_build_force_store_values(self,