ability to disable warnings validation

This commit is contained in:
2015-04-18 23:11:57 +02:00
parent 10768a6067
commit d959020eed
5 changed files with 48 additions and 10 deletions

View File

@ -581,9 +581,11 @@ class Option(OnlyOption):
if warning:
msg = _("warning on the value of the option {0}: {1}").format(
self.impl_getname(), warning)
warnings.warn_explicit(ValueWarning(msg, self),
ValueWarning,
self.__class__.__name__, 0)
if context is None or 'warnings' in \
context.cfgimpl_get_settings():
warnings.warn_explicit(ValueWarning(msg, self),
ValueWarning,
self.__class__.__name__, 0)
elif error:
raise ValueError(_("invalid value for option {0}: {1}").format(
self.impl_getname(), error))

View File

@ -78,8 +78,11 @@ everything_frozen
validator
launch validator set by user in option (this property has no effect
for internal validator)
warnings
display warnings during validation
"""
default_properties = ('cache', 'expire', 'validator')
default_properties = ('cache', 'expire', 'validator', 'warnings')
"""Config can be in two defaut mode: