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) return self._impl_values.get_information(key, default)
def impl_del_information(self, key, raises=True):
self._impl_values.del_information(key, raises)
# ----- state # ----- state
def __getstate__(self): def __getstate__(self):
if self._impl_meta is not None: if self._impl_meta is not None:

View File

@ -235,6 +235,13 @@ class Values(Cache):
" not found: {0}").format(key)) " not found: {0}").format(key))
return value 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): def exportation(self, session, fake=False):
return self._values return self._values

View File

@ -599,6 +599,9 @@ class Values(object):
""" """
return self._p_.get_information(key, default) 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): def mandatory_warnings(self, force_permissive=False, validate=True):
"""convenience function to trace Options that are mandatory and """convenience function to trace Options that are mandatory and
where no value has been set where no value has been set