r397 - in branches/rewrite: . src

Otavio Salvador partial-mirror-devel@lists.alioth.debian.org
Sat, 11 Dec 2004 19:21:51 -0700


Author: otavio
Date: Sat Dec 11 19:21:50 2004
New Revision: 397

Modified:
   branches/rewrite/   (props changed)
   branches/rewrite/src/Config.py
Log:
 r440@nurf:  otavio | 2004-12-12T02:21:50.658439Z
 Include namespace.


Modified: branches/rewrite/src/Config.py
==============================================================================
--- branches/rewrite/src/Config.py	(original)
+++ branches/rewrite/src/Config.py	Sat Dec 11 19:21:50 2004
@@ -16,9 +16,9 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 # $Id$
 
-from logging import *
-from ConfigParser import ConfigParser
-from sys import exit
+import logging
+import ConfigParser
+import sys
 
 class InvalidOption(Exception):
     """
@@ -102,7 +102,7 @@
                 for opt in opts:
                     key, val = opt.split(':')
                     if key not in self._allowed_in_filter_field:
-                        debug("[%s] is not a filter field (found in option [%s] in section [%s])." % (key, option, self.section))
+                        logging.debug("[%s] is not a filter field (found in option [%s] in section [%s])." % (key, option, self.section))
                         raise InvalidOption(self.section, option)
                     ret[key] = val
                 return ret
@@ -128,16 +128,16 @@
                     allowed_key, variable, match = rv
                     if variable == '@BACKEND@':
                         if match not in self.config.sections():
-                            debug("[%s] is not the name of a backend (found in [%s] option in [%s]"
+                            logging.debug("[%s] is not the name of a backend (found in [%s] option in [%s]"
                                   % (match, item, self.section))
                             raise InvalidOption(self.section, item)
                     else:
                         print("You found a bug: [%s] matches unknown variable [%s]! "
                               "Please report it." % (item, variable))
-                        exit(1)
+                        sys.exit(1)
                 else:
                     # __parseVariableOptions didn't return a sequence
-                    debug("[%s] is not allowed in a %s section (it was found in [%s])."
+                    logging.debug("[%s] is not allowed in a %s section (it was found in [%s])."
                           % (item, self._name, self.section))
                     raise InvalidOption(self.section, item)
             self.confs[item] = value
@@ -146,7 +146,7 @@
             if not self.confs.has_key(item):
                 rv = self.__parseVariableOptions(item)
                 if not hasattr(rv, '__len__'):
-                    debug("Required option [%s] not found in [%s] section." % (item, self.section))
+                    logging.debug("Required option [%s] not found in [%s] section." % (item, self.section))
                     raise RequiredOptionMissing(self.section, item)
                     
 class ConfigGlobal(ConfigSection):
@@ -228,7 +228,7 @@
 
     _name = "merge backend"
     
-class Config(ConfigParser):
+class Config(ConfigParser.ConfigParser):
     """
     Store the configurations used by our system.
     """
@@ -242,11 +242,11 @@
         elif 'server' in self.options(section):
             return ConfigBackendMirror
         else:
-            debug("Unknown section type in section [%s]." % (section))
+            logging.debug("Unknown section type in section [%s]." % (section))
             raise InvalidSection(section)
 
     def __init__(self, filename):
-        ConfigParser.__init__(self)
+        ConfigParser.ConfigParser.__init__(self)
         self.read(filename)
 
         self.confs = {}
@@ -287,16 +287,16 @@
 	    return self.confs[section][option]
         else:
             if section != 'GLOBAL':
-                debug("[%s] is not present in section [%s]. Fallback to global section." % (option, section))
+                logging.debug("[%s] is not present in section [%s]. Fallback to global section." % (option, section))
                 try:
                     return self.getOption(option, 'GLOBAL')
                 except InvalidOption, msg:
-                    debug("[%s] is not present in section [%s]." % (option, section))
+                    logging.debug("[%s] is not present in section [%s]." % (option, section))
                     raise InvalidOption(section, msg.option)
                 except InvalidSection, msg:
                     raise InvalidSection(msg.section)
             else:
-                debug("[%s] is not present in section [%s]." % (option, section))
+                logging.debug("[%s] is not present in section [%s]." % (option, section))
                 raise InvalidOption(section, option)
 
 	    return self.confs[section][option]