Commit 283a5360 authored by Romain Bignon's avatar Romain Bignon

Config.get() method

parent 2aa2e01b
......@@ -43,6 +43,25 @@ class Config:
self.path = path
self.sections = {}
def get(self, *args):
s = None
path = ''
for a in args:
if path: path += '.'
path += a
if not s:
try:
s = self.sections[a]
except KeyError:
s = self.sections[a] = Section(path)
else:
try:
s = s.values[a]
except KeyError:
s = s.values[a] = Section(path)
return s
def load(self):
parser = SafeConfigParser()
parser.read(self.path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment