some improvment
This commit is contained in:
@ -306,7 +306,7 @@ class Settings(object):
|
||||
old `SubConfig`, `Values`, `Multi` or `Settings`)
|
||||
"""
|
||||
context = self.context()
|
||||
if context is None: # pragma: optional cover
|
||||
if context is None: # pragma: no cover
|
||||
raise ConfigError(_('the context does not exist anymore'))
|
||||
return context
|
||||
|
||||
@ -576,22 +576,15 @@ class Settings(object):
|
||||
if path is not None and config_bag.option.impl_getrequires() is not None:
|
||||
not_allowed_props = properties & getattr(config_bag.option, '_calc_properties', static_set)
|
||||
if not_allowed_props:
|
||||
if len(not_allowed_props) == 1:
|
||||
prop_msg = _('property')
|
||||
calc_msg = _('this property is calculated')
|
||||
else:
|
||||
prop_msg = _('properties')
|
||||
calc_msg = _('those properties are calculated')
|
||||
raise ValueError(_('cannot set {} {} for option "{}" {}'
|
||||
'').format(prop_msg, display_list(list(not_allowed_props), add_quote=True),
|
||||
config_bag.option.impl_get_display_name(),
|
||||
calc_msg))
|
||||
raise ValueError(_('cannot set property {} for option "{}" this property is calculated'
|
||||
'').format(display_list(list(not_allowed_props), add_quote=True),
|
||||
config_bag.option.impl_get_display_name()))
|
||||
if config_bag is None:
|
||||
opt = None
|
||||
else:
|
||||
opt = config_bag.option
|
||||
if opt and opt.impl_is_symlinkoption():
|
||||
raise TypeError(_("can't assign properties to the SymLinkOption \"{}\""
|
||||
raise TypeError(_("can't assign property to the SymLinkOption \"{}\""
|
||||
"").format(opt.impl_get_display_name()))
|
||||
if 'force_default_on_freeze' in properties and \
|
||||
'frozen' not in properties and \
|
||||
@ -599,8 +592,6 @@ class Settings(object):
|
||||
raise ConfigError(_('a master ({0}) cannot have '
|
||||
'"force_default_on_freeze" property without "frozen"'
|
||||
'').format(opt.impl_get_display_name()))
|
||||
if not isinstance(properties, frozenset):
|
||||
raise TypeError(_('properties must be a frozenset'))
|
||||
self._p_.setproperties(path,
|
||||
properties)
|
||||
#values too because of slave values could have a PropertiesOptionError has value
|
||||
@ -658,7 +649,7 @@ class Settings(object):
|
||||
if opt and opt.impl_is_symlinkoption():
|
||||
raise TypeError(_("can't reset properties to the SymLinkOption \"{}\""
|
||||
"").format(opt.impl_get_display_name()))
|
||||
if all_properties and (path or opt): # pragma: optional cover
|
||||
if all_properties and (path or opt):
|
||||
raise ValueError(_('opt and all_properties must not be set '
|
||||
'together in reset'))
|
||||
if all_properties:
|
||||
|
Reference in New Issue
Block a user