[kernel] r10721 - people/waldi/dkt/lib/dkt/config

Bastian Blank waldi at alioth.debian.org
Wed Mar 5 14:03:47 UTC 2008


Author: waldi
Date: Wed Mar  5 14:03:46 2008
New Revision: 10721

Log:
lib/dkt/config/base.py: Always check for availability.


Modified:
   people/waldi/dkt/lib/dkt/config/base.py

Modified: people/waldi/dkt/lib/dkt/config/base.py
==============================================================================
--- people/waldi/dkt/lib/dkt/config/base.py	(original)
+++ people/waldi/dkt/lib/dkt/config/base.py	Wed Mar  5 14:03:46 2008
@@ -21,31 +21,35 @@
     def __iter__(self):
         return self._sections.iterkeys()
 
-    def get(self, section, option, default = _marker):
+    def _get(self, section, option):
         s = self._sections.get(section, _marker)
         if s is _marker:
-            if default is _marker:
-                raise KeyError(section)
-            return default
+            return _marker
         o = s.get(option, _marker)
         if o is _marker:
+            return _marker
+        return o
+
+    def get(self, section, option, default = _marker):
+        ret = self._get(section, option)
+        if ret is _marker:
             if default is _marker:
-                raise KeyError(option)
+                raise KeyError(section + ':' + option)
             return default
-        return o
+        return ret
 
     def get_parse_boolean(self, section, option, default = _marker):
-        s = self.get(section, option, _marker)
+        s = self._get(section, option)
         if s is _marker:
             if default is _marker:
-                raise KeyError((section, option))
+                raise KeyError(section + ':' +  option)
             return default
         s = s.lower()
         if s in ('true', 'yes', '1'):
             return True
         if s in ('false', 'no', '0'):
             return False
-        raise ValueError((section, option))
+        raise ValueError(section + ':' + option)
 
     def get_section(self, section, default = _marker):
         s = self._sections.get(section, _marker)



More information about the Kernel-svn-changes mailing list