Conditions | 3 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import os |
||
40 | def dbconfig(filename, section): |
||
41 | #create a parser |
||
42 | parser = ConfigParser() |
||
43 | #read config file |
||
44 | parser.read(filename) |
||
45 | |||
46 | #get section, default to postgres |
||
47 | db={} |
||
48 | if parser.has_section(section): |
||
49 | params = parser.items(section) |
||
50 | for param in params: |
||
51 | db[param[0]] = param[1] |
||
52 | else: |
||
53 | raise Exception('section {0} not found in the {1} file'.format(section,filename)) |
||
54 | return db |