summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/config.py15
-rw-r--r--src/leap/bitmask/core/configurable.py3
2 files changed, 18 insertions, 0 deletions
diff --git a/src/leap/bitmask/config.py b/src/leap/bitmask/config.py
index 833980d..4c1fbca 100644
--- a/src/leap/bitmask/config.py
+++ b/src/leap/bitmask/config.py
@@ -67,6 +67,9 @@ class Configuration(object):
self.read()
assert self.config.get(section, option) == value
+ def get_section(self, section):
+ return _ConfigurationSection(self, section)
+
def read(self):
self.config = ConfigParser.SafeConfigParser()
if not os.path.isfile(self.config_path):
@@ -82,3 +85,15 @@ class Configuration(object):
def _create_default_config(self):
with open(self.config_path, 'w') as outf:
outf.write(self.default_config)
+
+
+class _ConfigurationSection(object):
+ def __init__(self, config, section):
+ self.config = config
+ self.section = section
+
+ def get(self, option, default=None, boolean=False):
+ return self.config.get(self.section, option, default, boolean)
+
+ def set(self, option, value):
+ return self.config.set(self.section, option, value)
diff --git a/src/leap/bitmask/core/configurable.py b/src/leap/bitmask/core/configurable.py
index 262f030..5a9e5c9 100644
--- a/src/leap/bitmask/core/configurable.py
+++ b/src/leap/bitmask/core/configurable.py
@@ -42,6 +42,9 @@ class ConfigurableService(service.MultiService):
def set_config(self, section, option, value):
return self.cfg.set(section, option, value)
+ def get_config_section(self, section):
+ return self.cfg.get_section(section)
+
DEFAULT_CONFIG = """
[services]