user could delete informations set in config

This commit is contained in:
Emmanuel Garette 2016-04-28 11:31:04 +02:00
parent a76815dd1f
commit ef5bcbf98b
3 changed files with 15 additions and 2 deletions

View File

@ -606,6 +606,9 @@ class _CommonConfig(SubConfig):
"""
return self._impl_values.get_information(key, default)
def impl_del_information(self, key, raises=True):
self._impl_values.del_information(key, raises)
# ----- state
def __getstate__(self):
if self._impl_meta is not None:

View File

@ -235,6 +235,13 @@ class Values(Cache):
" not found: {0}").format(key))
return value
def del_information(self, key, raises):
if key in self._informations:
del(self._informations[key])
else:
if raises:
raise ValueError(_("information's item not found {0}").format(key))
def exportation(self, session, fake=False):
return self._values

View File

@ -113,7 +113,7 @@ class Values(object):
force_default = 'frozen' in self_properties and \
'force_default_on_freeze' in self_properties
# not default value
is_default = self._is_default_owner(opt, path, session,
is_default = self._is_default_owner(opt, path, session,
validate_properties=False,
validate_meta=False,
self_properties=self_properties,
@ -558,7 +558,7 @@ class Values(object):
:return: boolean
"""
path = opt.impl_getpath(self._getcontext())
return self._is_default_owner(opt, path, session=None,
return self._is_default_owner(opt, path, session=None,
validate_properties=validate_properties,
validate_meta=validate_meta, index=index,
force_permissive=force_permissive)
@ -599,6 +599,9 @@ class Values(object):
"""
return self._p_.get_information(key, default)
def del_information(self, key, raises=True):
self._p_.del_information(key, raises)
def mandatory_warnings(self, force_permissive=False, validate=True):
"""convenience function to trace Options that are mandatory and
where no value has been set