add logger in validation
This commit is contained in:
parent
76a43a7ff9
commit
da434a4273
|
@ -27,7 +27,7 @@ from IPy import IP
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from tiramisu.error import ConfigError, ConflictError, ValueWarning
|
from tiramisu.error import ConfigError, ConflictError, ValueWarning
|
||||||
from tiramisu.setting import groups, multitypes
|
from tiramisu.setting import groups, multitypes, log
|
||||||
from tiramisu.i18n import _
|
from tiramisu.i18n import _
|
||||||
from tiramisu.autolib import carry_out_calculation
|
from tiramisu.autolib import carry_out_calculation
|
||||||
|
|
||||||
|
@ -430,10 +430,14 @@ class Option(BaseOption):
|
||||||
val_validator(_value)
|
val_validator(_value)
|
||||||
self._second_level_validation(_value, self._warnings_only)
|
self._second_level_validation(_value, self._warnings_only)
|
||||||
except ValueError as error:
|
except ValueError as error:
|
||||||
|
log.debug(_('do_validation for {0}: error in value').format(
|
||||||
|
self._name), exc_info=True)
|
||||||
if self._warnings_only:
|
if self._warnings_only:
|
||||||
warning = error
|
warning = error
|
||||||
error = None
|
error = None
|
||||||
except ValueWarning as warning:
|
except ValueWarning as warning:
|
||||||
|
log.debug(_('do_validation for {0}: warning in value').format(
|
||||||
|
self._name), exc_info=True)
|
||||||
pass
|
pass
|
||||||
if error is None and warning is None:
|
if error is None and warning is None:
|
||||||
try:
|
try:
|
||||||
|
@ -441,8 +445,12 @@ class Option(BaseOption):
|
||||||
if context is not None:
|
if context is not None:
|
||||||
descr._valid_consistency(self, _value, context, _index)
|
descr._valid_consistency(self, _value, context, _index)
|
||||||
except ValueError as error:
|
except ValueError as error:
|
||||||
|
log.debug(_('do_validation for {0}: error in consistency').format(
|
||||||
|
self._name), exc_info=True)
|
||||||
pass
|
pass
|
||||||
except ValueWarning as warning:
|
except ValueWarning as warning:
|
||||||
|
log.debug(_('do_validation for {0}: warning in consistency').format(
|
||||||
|
self._name), exc_info=True)
|
||||||
pass
|
pass
|
||||||
if warning:
|
if warning:
|
||||||
msg = _("warning on the value of the option {0}: {1}").format(
|
msg = _("warning on the value of the option {0}: {1}").format(
|
||||||
|
@ -1543,10 +1551,10 @@ def validate_callback(callback, callback_params, type_):
|
||||||
if not isinstance(option, Option) and not \
|
if not isinstance(option, Option) and not \
|
||||||
isinstance(option, SymLinkOption):
|
isinstance(option, SymLinkOption):
|
||||||
raise ValueError(_('{0}_params must have an option'
|
raise ValueError(_('{0}_params must have an option'
|
||||||
' not a {0} for first argument'
|
' not a {0} for first argument'
|
||||||
).format(type_, type(option)))
|
).format(type_, type(option)))
|
||||||
if force_permissive not in [True, False]:
|
if force_permissive not in [True, False]:
|
||||||
raise ValueError(_('{0}_params must have a boolean'
|
raise ValueError(_('{0}_params must have a boolean'
|
||||||
' not a {0} for second argument'
|
' not a {0} for second argument'
|
||||||
).format(type_, type(
|
).format(type_, type(
|
||||||
force_permissive)))
|
force_permissive)))
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
from time import time
|
from time import time
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
from logging import getLogger
|
||||||
import weakref
|
import weakref
|
||||||
from tiramisu.error import (RequirementError, PropertiesOptionError,
|
from tiramisu.error import (RequirementError, PropertiesOptionError,
|
||||||
ConstError, ConfigError)
|
ConstError, ConfigError)
|
||||||
|
@ -99,6 +100,9 @@ rw_append = set(['frozen', 'disabled', 'validator', 'hidden'])
|
||||||
rw_remove = set(['permissive', 'everything_frozen', 'mandatory'])
|
rw_remove = set(['permissive', 'everything_frozen', 'mandatory'])
|
||||||
|
|
||||||
|
|
||||||
|
log = getLogger('tiramisu')
|
||||||
|
|
||||||
|
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
class _NameSpace(object):
|
class _NameSpace(object):
|
||||||
"""convenient class that emulates a module
|
"""convenient class that emulates a module
|
||||||
|
|
Loading…
Reference in New Issue