diff options
author | tv <tv@nomic.retiolum> | 2014-04-25 12:52:05 +0200 |
---|---|---|
committer | tv <tv@nomic.retiolum> | 2014-04-25 12:52:05 +0200 |
commit | e957c40e5ad65c3088454ef0463d7ae42452196b (patch) | |
tree | dd09441cd971c854ba4e3a4f35458394ade46be3 /IRC/getconf.py | |
parent | d7bdbaaa1659289be2b07a532f98058ecba32916 (diff) |
reaktor getconf: allow default_value
Diffstat (limited to 'IRC/getconf.py')
-rw-r--r-- | IRC/getconf.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/IRC/getconf.py b/IRC/getconf.py index f9cd440..168c908 100644 --- a/IRC/getconf.py +++ b/IRC/getconf.py @@ -9,14 +9,17 @@ import os def make_getconf(filename): - def getconf(prop): + def getconf(prop, default_value=None): prop_split = prop.split('.') string = '' config = load_config(filename) #imp.reload(config) tmp = config.__dict__ for pr in prop_split: - tmp = tmp[pr] + if pr in tmp: + tmp = tmp[pr] + else: + return default_value return tmp return getconf |