parent
fed7d0fb3d
commit
0064f70160
|
@ -40,8 +40,14 @@ def read_config(filename):
|
|||
app.config.update(config)
|
||||
'''
|
||||
|
||||
cparser = configparser.SafeConfigParser()
|
||||
cparser.readfp(open(filename))
|
||||
with open(filename) as f:
|
||||
# ConfigParser API changed in Python 3.2
|
||||
if hasattr(configparser.ConfigParser, 'read_file'):
|
||||
cparser = configparser.ConfigParser()
|
||||
cparser.read_file(f)
|
||||
else:
|
||||
cparser = configparser.SafeConfigParser()
|
||||
cparser.readfp(f)
|
||||
|
||||
config = {}
|
||||
for section in cparser.sections():
|
||||
|
|
Loading…
Reference in New Issue