Merge branch 'master' of ssh://git.labs.libre-entreprise.org/gitroot/tiramisu
authorgwen <gremond@cadoles.com>
Tue, 3 Sep 2013 09:01:37 +0000 (11:01 +0200)
committergwen <gremond@cadoles.com>
Tue, 3 Sep 2013 09:01:37 +0000 (11:01 +0200)
1  2 
tiramisu/option.py

@@@ -160,15 -124,31 +124,39 @@@ class BaseOption(object)
                                             name))
          object.__setattr__(self, name, value)
  
+     # information
+     def impl_set_information(self, key, value):
+         """updates the information's attribute
+         (which is a dictionary)
+         :param key: information's key (ex: "help", "doc"
+         :param value: information's value (ex: "the help string")
+         """
+         self._impl_informations[key] = value
+     def impl_get_information(self, key, default=None):
+         """retrieves one information's item
+         :param key: the item string (ex: "help")
+         """
+         if key in self._impl_informations:
+             return self._impl_informations[key]
+         elif default is not None:
+             return default
+         else:
+             raise ValueError(_("information's item not found: {0}").format(
+                 key))
+     # serialize/unserialize
      def _impl_convert_consistencies(self, descr, load=False):
 +        """during serialization process, many things have to be done.
 +        one of them is the localisation of the options.
 +        The paths are set once for all.
 +
 +        :type descr: :class:`tiramisu.option.OptionDescription`
 +        :param load: `True` if we are at the init of the option description
 +        :type load: bool
 +        """
          if not load and self._consistencies is None:
              self._state_consistencies = None
          elif load and self._state_consistencies is None:
              else:
                  self._state_requires = new_value
  
+     # serialize
      def _impl_getstate(self, descr):
 +        """the under the hood stuff that need to be done
 +        before the serialization.
 +
 +        :param descr: the parent :class:`tiramisu.option.OptionDescription`
 +        """
          self._stated = True
          self._impl_convert_consistencies(descr)
          self._impl_convert_requires(descr)