previous value api

This commit is contained in:
gwen 2013-02-26 14:56:15 +01:00
parent 762b0e9c69
commit 151bc83ba5
2 changed files with 10 additions and 0 deletions

View File

@ -225,6 +225,9 @@ class Option(HiddenBaseType, DisabledBaseType):
"config *must* be only the **parent** config (not the toplevel config)"
return config._cfgimpl_context._cfgimpl_values.getowner(self)
def get_previous_value(self, config):
return config._cfgimpl_context._cfgimpl_values.get_previous_value(self)
def reset(self, config):
"""resets the default value and owner
"""

View File

@ -76,6 +76,13 @@ class Values(object):
else:
self.previous_values[opt] = old_value
def get_previous_value(self, opt):
if opt in self.previous_values:
prec_value = self.previous_values[opt]
else:
prec_value = None
return prec_value
def _is_empty(self, opt, value=None):
"convenience method to know if an option is empty"
if value is not None: