Merge branch 'log'

This commit is contained in:
Emmanuel Garette 2014-04-03 22:16:08 +02:00
commit d1e86f6d48
2 changed files with 13 additions and 1 deletions

View File

@ -27,7 +27,7 @@ from IPy import IP
import warnings
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.autolib import carry_out_calculation
@ -430,10 +430,14 @@ class Option(BaseOption):
val_validator(_value)
self._second_level_validation(_value, self._warnings_only)
except ValueError as error:
log.debug(_('do_validation for {0}: error in value').format(
self._name), exc_info=True)
if self._warnings_only:
warning = error
error = None
except ValueWarning as warning:
log.debug(_('do_validation for {0}: warning in value').format(
self._name), exc_info=True)
pass
if error is None and warning is None:
try:
@ -441,8 +445,12 @@ class Option(BaseOption):
if context is not None:
descr._valid_consistency(self, _value, context, _index)
except ValueError as error:
log.debug(_('do_validation for {0}: error in consistency').format(
self._name), exc_info=True)
pass
except ValueWarning as warning:
log.debug(_('do_validation for {0}: warning in consistency').format(
self._name), exc_info=True)
pass
if warning:
msg = _("warning on the value of the option {0}: {1}").format(

View File

@ -17,6 +17,7 @@
# ____________________________________________________________
from time import time
from copy import copy
from logging import getLogger
import weakref
from tiramisu.error import (RequirementError, PropertiesOptionError,
ConstError, ConfigError)
@ -99,6 +100,9 @@ rw_append = set(['frozen', 'disabled', 'validator', 'hidden'])
rw_remove = set(['permissive', 'everything_frozen', 'mandatory'])
log = getLogger('tiramisu')
# ____________________________________________________________
class _NameSpace(object):
"""convenient class that emulates a module