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
|
@ -8,7 +8,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.4.1"
|
self.version = "0.4.1"
|
||||||
self.rev = 1527
|
self.rev = 1529
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.config_file = "zeronet.conf"
|
self.config_file = "zeronet.conf"
|
||||||
|
|
|
@ -236,10 +236,16 @@ class SiteStorage(object):
|
||||||
# Make it a little more compact by removing unnecessary white space
|
# Make it a little more compact by removing unnecessary white space
|
||||||
|
|
||||||
def compact_list(match):
|
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):
|
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_list, content, flags=re.DOTALL)
|
||||||
content = re.sub("\{([^,\[\{]{10,100}?)\}", compact_dict, content, flags=re.DOTALL)
|
content = re.sub("\{([^,\[\{]{10,100}?)\}", compact_dict, content, flags=re.DOTALL)
|
||||||
|
|
Loading…
Reference in a new issue