if not need, don't validate
This commit is contained in:
parent
c13846238d
commit
c91e7eff97
|
@ -258,30 +258,29 @@ class Option(BaseInformation):
|
||||||
# generic calculation
|
# generic calculation
|
||||||
if context is not None:
|
if context is not None:
|
||||||
descr = context.cfgimpl_get_description()
|
descr = context.cfgimpl_get_description()
|
||||||
if not self._multi:
|
if validate:
|
||||||
if value is not None and ((validate and
|
if not self._multi:
|
||||||
self._validator is not None and
|
if value is not None and ((self._validator is not None and
|
||||||
not val_validator()) or
|
not val_validator()) or
|
||||||
not self._validate(value)):
|
not self._validate(value)):
|
||||||
raise ValueError(_("invalid value {0} for option {1}"
|
raise ValueError(_("invalid value {0} for option {1}"
|
||||||
"").format(value, self._name))
|
"").format(value, self._name))
|
||||||
if context is not None:
|
|
||||||
descr._valid_consistency(self, value, context, None)
|
|
||||||
else:
|
|
||||||
if not isinstance(value, list):
|
|
||||||
raise ValueError(_("invalid value {0} for option {1} "
|
|
||||||
"which must be a list").format(value,
|
|
||||||
self._name))
|
|
||||||
for index in range(0, len(value)):
|
|
||||||
val = value[index]
|
|
||||||
if val is not None and ((validate and
|
|
||||||
self._validator is not None and
|
|
||||||
not val_validator()) or
|
|
||||||
not self._validate(val)):
|
|
||||||
raise ValueError(_("invalid value {0} for option {1}"
|
|
||||||
"").format(value, self._name))
|
|
||||||
if context is not None:
|
if context is not None:
|
||||||
descr._valid_consistency(self, val, context, index)
|
descr._valid_consistency(self, value, context, None)
|
||||||
|
else:
|
||||||
|
if not isinstance(value, list):
|
||||||
|
raise ValueError(_("invalid value {0} for option {1} "
|
||||||
|
"which must be a list").format(value,
|
||||||
|
self._name))
|
||||||
|
for index in range(0, len(value)):
|
||||||
|
val = value[index]
|
||||||
|
if val is not None and ((self._validator is not None and
|
||||||
|
not val_validator()) or
|
||||||
|
not self._validate(val)):
|
||||||
|
raise ValueError(_("invalid value {0} for option {1}"
|
||||||
|
"").format(value, self._name))
|
||||||
|
if context is not None:
|
||||||
|
descr._valid_consistency(self, val, context, index)
|
||||||
|
|
||||||
def impl_getdefault(self, default_multi=False):
|
def impl_getdefault(self, default_multi=False):
|
||||||
"accessing the default value"
|
"accessing the default value"
|
||||||
|
|
Loading…
Reference in New Issue