don't display warning in mandatory_warnings
This commit is contained in:
@ -403,6 +403,7 @@ class Option(OnlyOption):
|
||||
all_cons_vals.append(value)
|
||||
else:
|
||||
#if context, calculate value, otherwise get default value
|
||||
path = None
|
||||
if context is not undefined:
|
||||
if isinstance(opt, DynSymLinkOption):
|
||||
path = opt.impl_getpath(context)
|
||||
@ -437,7 +438,8 @@ class Option(OnlyOption):
|
||||
|
||||
def impl_validate(self, value, context=undefined, validate=True,
|
||||
force_index=None, force_submulti_index=None,
|
||||
current_opt=undefined, is_multi=None):
|
||||
current_opt=undefined, is_multi=None,
|
||||
display_warnings=True):
|
||||
"""
|
||||
:param value: the option's value
|
||||
:param context: Config's context
|
||||
@ -507,16 +509,18 @@ class Option(OnlyOption):
|
||||
self.impl_get_display_name())
|
||||
return ValueError(msg)
|
||||
warning = None
|
||||
error = calculation_validator(_value)
|
||||
if not error:
|
||||
error = self._second_level_validation(_value, self._is_warnings_only())
|
||||
if error:
|
||||
if debug:
|
||||
log.debug(_('do_validation for {0}: error in value').format(
|
||||
self.impl_getname()), exc_info=True)
|
||||
if self._is_warnings_only():
|
||||
warning = error
|
||||
error = None
|
||||
error = None
|
||||
if display_warnings:
|
||||
error = calculation_validator(_value)
|
||||
if not error:
|
||||
error = self._second_level_validation(_value, self._is_warnings_only())
|
||||
if error:
|
||||
if debug:
|
||||
log.debug(_('do_validation for {0}: error in value').format(
|
||||
self.impl_getname()), exc_info=True)
|
||||
if self._is_warnings_only():
|
||||
warning = error
|
||||
error = None
|
||||
if error is None and warning is None:
|
||||
# if context launch consistency validation
|
||||
#if context is not undefined:
|
||||
@ -524,7 +528,8 @@ class Option(OnlyOption):
|
||||
_index, submulti_index)
|
||||
if ret:
|
||||
if isinstance(ret, ValueWarning):
|
||||
warning = ret
|
||||
if display_warnings:
|
||||
warning = ret
|
||||
elif isinstance(ret, ValueError):
|
||||
error = ret
|
||||
else:
|
||||
@ -991,12 +996,14 @@ class DynSymLinkOption(object):
|
||||
return base_path + '.' + self._dyn
|
||||
|
||||
def impl_validate(self, value, context=undefined, validate=True,
|
||||
force_index=None, force_submulti_index=None, is_multi=None):
|
||||
force_index=None, force_submulti_index=None, is_multi=None,
|
||||
display_warnings=True):
|
||||
return self._impl_getopt().impl_validate(value, context, validate,
|
||||
force_index,
|
||||
force_submulti_index,
|
||||
current_opt=self,
|
||||
is_multi=is_multi)
|
||||
is_multi=is_multi,
|
||||
display_warnings=display_warnings)
|
||||
|
||||
def impl_is_dynsymlinkoption(self):
|
||||
return True
|
||||
|
Reference in New Issue
Block a user