This commit is contained in:
2018-09-12 21:05:14 +02:00
parent 10aaf2219f
commit cd7977eae6
13 changed files with 140 additions and 81 deletions

View File

@ -74,6 +74,15 @@ class CacheOptionDescription(BaseOption):
if not option.impl_is_symlinkoption():
properties = option.impl_getproperties()
if 'force_store_value' in properties:
if option.impl_is_master_slaves('slave'):
# problem with index
raise ConfigError(_('the slave "{0}" cannot have '
'"force_store_value" property').format(
option.impl_get_display_name()))
if option.issubdyn():
raise ConfigError(_('the dynoption "{0}" cannot have '
'"force_store_value" property').format(
option.impl_get_display_name()))
force_store_values.append((subpath, option))
if 'force_default_on_freeze' in properties and \
'frozen' not in properties and \
@ -163,15 +172,6 @@ class CacheOptionDescription(BaseOption):
value_setted = False
values = context.cfgimpl_get_values()
for subpath, option in self._cache_force_store_values:
if option.impl_is_master_slaves('slave'):
# problem with index
raise ConfigError(_('the slave "{0}" cannot have '
'"force_store_value" property').format(
option.impl_get_display_name()))
if option.issubdyn():
raise ConfigError(_('the dynoption "{0}" cannot have '
'"force_store_value" property').format(
option.impl_get_display_name()))
if not values._p_.hasvalue(subpath):
config_bag = ConfigBag(context=context)
option_bag = OptionBag()
@ -429,12 +429,6 @@ class OptionDescription(OptionDescriptionWalk):
def impl_getdoc(self):
return self.impl_get_information('doc')
def impl_validate(self,
*args,
**kwargs):
"""usefull for OptionDescription"""
pass
# ____________________________________________________________
def impl_set_group_type(self,
group_type):
@ -444,8 +438,8 @@ class OptionDescription(OptionDescriptionWalk):
that lives in `setting.groups`
"""
if self._group_type != groups.default:
raise TypeError(_('cannot change group_type if already set '
'(old {0}, new {1})').format(self._group_type,
raise ValueError(_('cannot change group_type if already set '
'(old {0}, new {1})').format(self._group_type,
group_type))
if not isinstance(group_type, groups.GroupType):
raise ValueError(_('group_type: {0}'