Rev1529, Fix json write bug with [] characters in value
This commit is contained in:
parent
6a58083431
commit
d760a71b76
2 changed files with 9 additions and 3 deletions
|
@ -236,10 +236,16 @@ class SiteStorage(object):
|
|||
# Make it a little more compact by removing unnecessary white space
|
||||
|
||||
def compact_list(match):
|
||||
return "[ " + match.group(1).strip() + " ]"
|
||||
if "\n" in match.group(1):
|
||||
return "[ " + match.group(1).strip() + " ]"
|
||||
else:
|
||||
return match.group(0)
|
||||
|
||||
def compact_dict(match):
|
||||
return "{ " + match.group(1).strip() + " }"
|
||||
if "\n" in match.group(1):
|
||||
return "{ " + match.group(1).strip() + " }"
|
||||
else:
|
||||
return match.group(0)
|
||||
|
||||
content = re.sub("\[([^,\{\[]{10,100}?)\]", compact_list, content, flags=re.DOTALL)
|
||||
content = re.sub("\{([^,\[\{]{10,100}?)\}", compact_dict, content, flags=re.DOTALL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue