Commit abd890c7 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

monitor: improve settings.cgi reliability

parent 7e4ec422
...@@ -17,13 +17,18 @@ config_file = "{{ config_cfg }}" ...@@ -17,13 +17,18 @@ config_file = "{{ config_cfg }}"
if not os.path.exists(config_file): if not os.path.exists(config_file):
print "Your software does <b>not</b> embed 0-knowledge. \ print "Your software does <b>not</b> embed 0-knowledge. \
This interface is useless in this case" This interface is useless in this case</body></html>"
exit(0) exit(0)
parser = ConfigParser.ConfigParser() parser = ConfigParser.ConfigParser()
parser.read(config_file) parser.read(config_file)
if not parser.has_section('public'):
print "<p>Your software does not use 0-knowledge settings.</p></body></html>"
exit(0)
for name in form: for name in form:
if parser.has_option('public', name):
parser.set('public', name, form[name].value) parser.set('public', name, form[name].value)
with open(config_file, 'w') as file: with open(config_file, 'w') as file:
parser.write(file) parser.write(file)
......
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