r134 - branches/rewrite/src
Otavio Salvador
partial-mirror-devel@lists.alioth.debian.org
Fri, 02 Jul 2004 09:20:10 -0600
Author: otavio
Date: Fri Jul 2 09:20:09 2004
New Revision: 134
Modified:
branches/rewrite/src/Config.py
Log:
Change from key to option to be more clear. Add a exception call too.
Modified: branches/rewrite/src/Config.py
==============================================================================
--- branches/rewrite/src/Config.py (original)
+++ branches/rewrite/src/Config.py Fri Jul 2 09:20:09 2004
@@ -117,18 +117,18 @@
raise InvalidOption(section, item)
self[section][item] = value
- def getOption(self, key, section='GLOBAL'):
+ def getOption(self, option, section='GLOBAL'):
# get a config value for a certain section. if it's not
# specified, fall back to GLOBAL
- if not self.has_key(section):
+ if not self.has_option(section):
debug("no config section called [%s]." % (section))
raise InvalidSection(section)
- if self[section].has_key(key):
- return self[section][key]
- if not self['GLOBAL'].has_key(key):
- debug("[%s] is not present in section [%s] or the global section of config file." % (key, section))
- exit(1)
- return self['GLOBAL'][key]
+ if self[section].has_option(option):
+ return self[section][option]
+ if not self['GLOBAL'].has_option(option):
+ debug("[%s] is not present in section [%s] nor the global section of config file." % (option, section))
+ raise InvalidOption(section, option)
+ return self['GLOBAL'][option]
def dump(self):
for section, options in self.items():