summaryrefslogtreecommitdiff
path: root/python/skytools/config.py
diff options
context:
space:
mode:
authormartinko2011-08-22 11:18:36 +0000
committermartinko2011-08-22 11:18:36 +0000
commit498c0175fba4eb50d1dff159270a78aeb2be2b01 (patch)
tree4f791ab85a3366b0545019448e14b83ef8332d78 /python/skytools/config.py
parent152b3de9c49364cb3454b0dfbe5d58da140a10b7 (diff)
minor typos fixed
Diffstat (limited to 'python/skytools/config.py')
-rw-r--r--python/skytools/config.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/python/skytools/config.py b/python/skytools/config.py
index 089f43fa..9ec90168 100644
--- a/python/skytools/config.py
+++ b/python/skytools/config.py
@@ -10,7 +10,7 @@ class Config(object):
Additional features:
- Remembers section.
- - Acceps defaults in get() functions.
+ - Accepts defaults in get() functions.
- List value support.
"""
def __init__(self, main_section, filename, sane_config = 1, user_defs = {}, override = {}, ignore_defs = False):
@@ -121,9 +121,9 @@ class Config(object):
def getdict(self, key, default=None):
"""Reads key-value dict from parameter.
-
+
Key and value are separated with ':'. If missing,
- key iself is taken as value.
+ key itself is taken as value.
"""
try:
s = self.cf.get(self.main_section, key).strip()
@@ -147,7 +147,7 @@ class Config(object):
def getfile(self, key, default=None):
"""Reads filename from config.
-
+
In addition to reading string value, expands ~ to user directory.
"""
fn = self.get(key, default)
@@ -163,10 +163,10 @@ class Config(object):
def get_wildcard(self, key, values=[], default=None):
"""Reads a wildcard property from conf and returns its string value, if not set then default."""
-
+
orig_key = key
keys = [key]
-
+
for wild in values:
key = key.replace('*', wild, 1)
keys.append(key)
@@ -181,7 +181,7 @@ class Config(object):
if default == None:
raise Exception("Config value not set: " + orig_key)
return default
-
+
def sections(self):
"""Returns list of sections in config file, excluding DEFAULT."""
return self.cf.sections()
@@ -198,4 +198,3 @@ class Config(object):
def has_option(self, opt):
"""Checks if option exists in main section."""
return self.cf.has_option(self.main_section, opt)
-