registry: Add a header to the configuration file telling not to edit it.

This commit is contained in:
Valentin Lorentz 2015-05-20 13:58:15 +02:00
parent 6a912bbbe2
commit 721cb06dcd

View File

@ -108,9 +108,24 @@ def open_registry(filename, clear=False):
_lastModified = time.time() _lastModified = time.time()
_fd.close() _fd.close()
CONF_FILE_HEADER = """
######
# Althrough it is technically possible to do so, we do not recommend that
# you edit this file with a text editor.
# Whenever possible, do it on IRC using the Config plugin, which
# checks values you set are valid before writing them to the
# configuration.
# Moreover, if you edit this file while the bot is running, your
# changes may be lost.
######
"""
def close(registry, filename, private=True): def close(registry, filename, private=True):
first = True first = True
fd = utils.file.AtomicFile(filename) fd = utils.file.AtomicFile(filename)
fd.write(CONF_FILE_HEADER)
for (name, value) in registry.getValues(getChildren=True): for (name, value) in registry.getValues(getChildren=True):
help = value.help() help = value.help()
if help: if help: