r167 - branches/rewrite/src

Otavio Salvador partial-mirror-devel@lists.alioth.debian.org
Tue, 06 Jul 2004 18:28:52 -0600


Author: otavio
Date: Tue Jul  6 18:28:51 2004
New Revision: 167

Modified:
   branches/rewrite/src/Config.py
Log:
Fix sintax errors and start to include code to handle porperty the option types.

Modified: branches/rewrite/src/Config.py
==============================================================================
--- branches/rewrite/src/Config.py	(original)
+++ branches/rewrite/src/Config.py	Tue Jul  6 18:28:51 2004
@@ -57,6 +57,12 @@
     def __init__(self, section):
         self.section = section
 
+### TODO: Rewrite the Config parser structure to use:
+###     Config
+###        ConfigGlobal
+###        ConfigBackend
+###           ConfigBackendMirror
+###           ConfigBackendMerge
 class Config(ConfigParser):
     """
     Store the configurations used by our system.
@@ -97,6 +103,12 @@
 	'name',
         ]
 
+    _allowed_in_filter_field = [
+        'subsection',
+        'priority',
+        'name'
+        ]
+
     # if not included here, it's string
     _options_with_type = {
         'architectures': 'list',
@@ -135,9 +147,9 @@
 
             ###HACK.  Split this out later into subclasses.
             # detect which config type this is
-            if 'backends' in self._options(section):
+            if 'backends' in self.options(section):
                 allowed_in_section = self._allowed_in_merge_backend
-            elif 'server' in self._options(section):
+            elif 'server' in self.options(section):
                 allowed_in_section = self._allowed_in_mirror_backend
             else:
                 debug("Unknown section type in section [%s]." % (section))
@@ -176,7 +188,7 @@
 	    debug("no config section called [%s]." % (section))
 	    raise InvalidSection(section)
 	if self.confs[section].has_key(option):
-	    conf = self.confs[section][option]
+	    return self.confs[section][option]
         else:
             if section != 'GLOBAL':
                 debug("[%s] is not present in section [%s]. Fallback to global section." % (option, section))
@@ -191,15 +203,7 @@
                 debug("[%s] is not present in section [%s]." % (option, section))
                 raise InvalidOption(section, option)
 
-        if option in self._options_with_type:
-            if self._options_with_type[option] == 'list':
-                return conf.split()
-            elif self._options_with_type[option] == 'boolean':
-                return bool(conf)
-#            elif self._options_with_type[option] == 'dict':
-#                return map(conf.split())
-        else:
-            return conf
+	    return self.confs[section][option]
         
 
     def dump(self):