# HG changeset patch # User Mads Kiilerich # Date 2018-03-11 15:24:47 # Node ID 06ae370ffaa34f6a3665b7bdbcd2b959d0c85b43 # Parent dba4e770d4b6eb5743e6b7317ebaaf0fa88863a0 ini: only keep default value as comment if the custom value actually is different diff --git a/kallithea/lib/inifile.py b/kallithea/lib/inifile.py --- a/kallithea/lib/inifile.py +++ b/kallithea/lib/inifile.py @@ -112,8 +112,10 @@ def expand(template, mako_variable_value key, value = m.groups() line = m.group(0) if key in section_settings: - # keep old entry as example - comments might refer to it - line = '#%s\n%s = %s' % (line, key, section_settings.pop(key)) + new_line = '%s = %s' % (key, section_settings.pop(key)) + if new_line != line: + # keep old entry as example - comments might refer to it + line = '#%s\n%s' % (line, new_line) return line.rstrip() # process lines that not are comments or empty and look like name=value