summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-09-09 12:13:04 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-09-09 12:13:04 -0400
commit971ed9bbb320435a6353bb97efeea263d4bb2b96 (patch)
tree851f87096f3075b392a90efc79386932fda769fd
parenta73fa698be08dc0e591c2a9d2c8ddbbe0b08d105 (diff)
downloadrpmbuild-remote-971ed9bbb320435a6353bb97efeea263d4bb2b96.zip
rpmbuild-remote-971ed9bbb320435a6353bb97efeea263d4bb2b96.tar.gz
rpmbuild-remote-971ed9bbb320435a6353bb97efeea263d4bb2b96.tar.xz
Don't return None, but {} when the section doesn't exist
-rwxr-xr-xrpmbuild-remote.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/rpmbuild-remote.py b/rpmbuild-remote.py
index 82c0839..04c355e 100755
--- a/rpmbuild-remote.py
+++ b/rpmbuild-remote.py
@@ -58,23 +58,22 @@ def get_parser():
return parser
def read_section(config, section, values):
- if not config.has_section(section):
- return
ret = {}
- for value, typ in values:
- if config.has_option(section, value):
- if typ == 'int':
- method = config.getint
- elif typ == 'float':
- method = config.getfloat
- elif typ == 'boolean':
- method = config.getboolean
- elif typ == 'str':
- method = config.get
- else:
- method = config.get
- LOG.warning("Unknown type %s, assuming string" % typ)
- ret[value] = method(section, value)
+ if config.has_section(section):
+ for value, typ in values:
+ if config.has_option(section, value):
+ if typ == 'int':
+ method = config.getint
+ elif typ == 'float':
+ method = config.getfloat
+ elif typ == 'boolean':
+ method = config.getboolean
+ elif typ == 'str':
+ method = config.get
+ else:
+ method = config.get
+ LOG.warning("Unknown type %s, assuming string" % typ)
+ ret[value] = method(section, value)
return ret
def read_preferences(opts):