summaryrefslogtreecommitdiffstats
path: root/pykolab/conf
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2019-10-25 10:28:05 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2019-10-25 10:28:05 +0200
commitb34c794d14c714e5a3007a2e535425e6dfee51a5 (patch)
tree15c209f6fac75aeaa23d1a038457d87ca1336945 /pykolab/conf
parentf67a1132ea2048c2116d26770f6b35c19764d8c6 (diff)
downloadpykolab-b34c794d14c714e5a3007a2e535425e6dfee51a5.tar.gz
Make sure that config functions do take and honor the default value passed along
Diffstat (limited to 'pykolab/conf')
-rw-r--r--pykolab/conf/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/pykolab/conf/__init__.py b/pykolab/conf/__init__.py
index 64dfbe5..16f38d8 100644
--- a/pykolab/conf/__init__.py
+++ b/pykolab/conf/__init__.py
@@ -564,7 +564,7 @@ class Conf(object):
return self.cfg_parser.has_option(section, option)
- def get_list(self, section, key):
+ def get_list(self, section, key, default=None):
"""
Gets a comma and/or space separated list from the configuration file
and returns a list.
@@ -573,13 +573,14 @@ class Conf(object):
untrimmed_values = []
setting = self.get_raw(section, key)
+
if setting is None:
- return []
+ return default if default else []
raw_values = setting.split(',')
if raw_values is None:
- return []
+ return default if default else []
for raw_value in raw_values:
untrimmed_values.extend(raw_value.split(' '))