Changeset - 3c53e19719cd
[Not reviewed]
stable
0 1 0
Mads Kiilerich - 6 years ago 2020-04-23 11:02:07
mads@kiilerich.com
Grafted from: f753bcc21c0d
inifile: strip trailing spaces consistently
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/inifile.py
Show inline comments
 
@@ -182,25 +182,25 @@ def expand(template, mako_variable_value
 
                else:
 
                    line += '\n%s = %s' % (key, new_value)
 
                section_settings.pop(key)
 
                return line
 

	
 
            lines = re.sub(r'^#([^#\n\s]*)[ \t]*=[ \t]*(.*)$', add_after_comment, lines, flags=re.MULTILINE)
 

	
 
            # 3rd pass:
 
            # settings that haven't been consumed yet at is appended to section
 
            if section_settings:
 
                lines += '\n' + ''.join('%s = %s\n' % (key, value) for key, value in sorted(section_settings.items()))
 

	
 
        return sectionname + '\n' + lines
 
        return sectionname + '\n' + re.sub('[ \t]+\n', '\n', lines)
 

	
 
    # process sections until comments before next section or end
 
    ini_lines = re.sub(r'''^
 
        (\[.*\])\n
 
        # after the section name, a number of chunks with:
 
        (
 
            (?:
 
                # a number of comments or empty lines
 
                (?:[#].*\n|\n)*
 
                # one or more non-empty non-comments non-section-start lines
 
                (?:[^\n#[].*\n)+
 
                # a number of comments - not empty lines
0 comments (0 inline, 0 general)