]> git.ipfire.org Git - pakfire.git/commitdiff
config: Add function to read configuration from string
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 3 Dec 2016 10:45:27 +0000 (11:45 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 3 Dec 2016 10:45:27 +0000 (11:45 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/config.py

index 66c1d957b6621892d0989c45e2cdafa9caa906b7..2d2fdc27a296346e7507d3102a4cd4cbb9bac715 100644 (file)
@@ -55,6 +55,12 @@ class Config(object):
                with open(path) as f:
                        self._config.readfp(f)
 
+       def parse(self, s):
+               """
+                       Takes configuration as a string and parses it
+               """
+               self._config.read_string(s)
+
        def get(self, section, option, default=None):
                return self._config.get(section, option, fallback=default)