all multi gestion is now in Multi
This commit is contained in:
@ -218,6 +218,30 @@ class Setting(object):
|
||||
self.set_properties(properties, opt)
|
||||
self.context.cfgimpl_clean_cache()
|
||||
|
||||
def _validate_mandatory(self, opt, value, force_properties=None):
|
||||
set_mandatory = self.has_property('mandatory')
|
||||
if force_properties is not None:
|
||||
set_mandatory = ('mandatory' in force_properties or
|
||||
set_mandatory)
|
||||
if set_mandatory and self.has_property('mandatory', opt, False) and \
|
||||
self.context.cfgimpl_get_values()._is_empty(opt, value):
|
||||
return True
|
||||
return False
|
||||
|
||||
def _calc_properties(self, opt_or_descr, force_permissive, force_properties):
|
||||
properties = set(self.get_properties(opt_or_descr))
|
||||
#remove this properties, those properties are validate in after
|
||||
properties = properties - set(['mandatory', 'frozen'])
|
||||
set_properties = self.get_properties()
|
||||
if force_properties is not None:
|
||||
set_properties.extend(force_properties)
|
||||
set_properties = set(set_properties)
|
||||
properties = properties & set_properties
|
||||
if force_permissive is True or self.has_property('permissive', is_apply_req=False):
|
||||
properties = properties - set(self.get_permissive())
|
||||
properties = properties - set(self.get_permissive(opt_or_descr))
|
||||
return list(properties)
|
||||
|
||||
#____________________________________________________________
|
||||
def validate_properties(self, opt_or_descr, is_descr, is_write,
|
||||
value=None, force_permissive=False,
|
||||
@ -230,26 +254,16 @@ class Setting(object):
|
||||
properties = props
|
||||
is_cached = True
|
||||
if not is_cached:
|
||||
properties = set(self.get_properties(opt_or_descr))
|
||||
#remove this properties, those properties are validate in after
|
||||
properties = properties - set(['mandatory', 'frozen'])
|
||||
set_properties = self.get_properties()
|
||||
if force_properties is not None:
|
||||
set_properties.extend(force_properties)
|
||||
set_properties = set(set_properties)
|
||||
properties = properties & set_properties
|
||||
if force_permissive is True or self.has_property('permissive', is_apply_req=False):
|
||||
properties = properties - set(self.get_permissive())
|
||||
properties = properties - set(self.get_permissive(opt_or_descr))
|
||||
properties = list(properties)
|
||||
properties = self._calc_properties(opt_or_descr, force_permissive,
|
||||
force_properties)
|
||||
raise_text = _("trying to access"
|
||||
" to an option named: {0} with properties"
|
||||
" {1}")
|
||||
if not is_descr:
|
||||
if self.context.cfgimpl_get_values().is_mandatory_err(opt_or_descr,
|
||||
value,
|
||||
force_properties=force_properties):
|
||||
if self._validate_mandatory(opt_or_descr, value,
|
||||
force_properties=force_properties):
|
||||
properties.append('mandatory')
|
||||
#frozen
|
||||
if is_write and (self.has_property('everything_frozen') or (
|
||||
self.has_property('frozen') and
|
||||
self.has_property('frozen', opt_or_descr,
|
||||
|
Reference in New Issue
Block a user