summaryrefslogtreecommitdiffstats
path: root/Reaktor/IRC/getconf.py
blob: 5fdd1cdbeff7066cba14150cc5b6012a77d8de42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#getconf = make_getconf("dateiname.json") 
#getconf(key) -> value                    
#oder error                               

import json

def make_getconf(filename):
    def getconf(prop):
        prop_split = prop.split('.')
        string = ''
        file = open(filename)
        for line in file.readlines():
            string+=line
        parsed = json.loads(string)
        tmp = parsed
        for pr in prop_split:
            tmp = tmp[pr]

        return tmp
    return getconf