previous value api
authorgwen <gremond@cadoles.com>
Tue, 26 Feb 2013 13:56:15 +0000 (14:56 +0100)
committergwen <gremond@cadoles.com>
Tue, 26 Feb 2013 13:56:15 +0000 (14:56 +0100)
tiramisu/option.py
tiramisu/value.py

index 9fc559a..88ce51e 100644 (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
         """
index 237dd7c..d62d558 100644 (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: