changeset 6888:952a83c9e478

ini: be less strict about amount of whitespace around '=' in templates Allow any amount of space/tab around '=' ... but no other whitespace on the left hand side.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 14 Sep 2017 02:08:06 +0200
parents d7222b590156
children 73934760f601
files kallithea/lib/inifile.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/inifile.py	Thu Sep 14 02:08:06 2017 +0200
+++ b/kallithea/lib/inifile.py	Thu Sep 14 02:08:06 2017 +0200
@@ -61,7 +61,8 @@
     [first-section]
     <BLANKLINE>
     variable=VALUE
-    variable2  =    value after tab
+    #variable2 = value after tab
+    variable2 = VAL2
     ## This section had some whitespace and stuff
     <BLANKLINE>
     <BLANKLINE>
@@ -117,7 +118,7 @@
                     if '$' not in value:
                         line = '#%s = %s\n%s' % (key, value, line)
                 return line.rstrip()
-            lines = re.sub(r'^([^#\n].*) = ?(.*)', process_line, lines, flags=re.MULTILINE)
+            lines = re.sub(r'^([^#\n\s]*)[ \t]*=[ \t]*(.*)$', process_line, lines, flags=re.MULTILINE)
         return sectionname + '\n' + lines
     ini_lines = re.sub(r'^(\[.*\])\n((?:(?:[^[\n].*)?\n)*)', process_section, ini_lines, flags=re.MULTILINE)