VMM/Config: LazyConfig.getboolean(), convert the value in our getboolean. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Mon, 22 Feb 2010 10:44:13 +0000
branchv0.6.x
changeset 211 0b129678cfe1
parent 210 3ddb735ec9d2
child 212 77ac6f572855
VMM/Config: LazyConfig.getboolean(), convert the value in our getboolean. So RawConfigParser hasn't to do the whole get() stuff again.
VirtualMailManager/Config.py
--- a/VirtualMailManager/Config.py	Mon Feb 22 10:25:48 2010 +0000
+++ b/VirtualMailManager/Config.py	Mon Feb 22 10:44:13 2010 +0000
@@ -94,7 +94,9 @@
         tmp = self.get(section, option)
         if isinstance(tmp, bool):
             return tmp
-        return RawConfigParser.getboolean(self, section, option)
+        if not tmp.lower() in self._boolean_states:
+            raise ValueError, 'Not a boolean: %s' % tmp
+        return self._boolean_states[tmp.lower()]
 
     def _get_section_option(self, section_option):
         """splits ``section_option`` (section\ **.**\ option) in two parts