fix empty arrays

This commit is contained in:
ziirish 2018-02-20 11:28:57 +01:00
parent 2862242ae6
commit 1eef0c123a
No known key found for this signature in database
GPG key ID: 72DB229A64B54E46
4 changed files with 4 additions and 4 deletions

View file

@ -30,6 +30,6 @@ indent_style = tab
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
[.gitlab-ci.yml}] [.gitlab-ci.yml]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2

View file

@ -323,6 +323,8 @@ class BUIConfig(dict):
"'{}': no such validator".format(cast) "'{}': no such validator".format(cast)
) )
return val return val
if cast == 'force_list' and val is None:
val = []
ret = caster(val) ret = caster(val)
# special case for boolean and integer, etc. # special case for boolean and integer, etc.
if ret is None: if ret is None:

View file

@ -26,7 +26,7 @@ def sanitize_string(string, strict=True, paranoid=False):
else: else:
import re import re
ret = repr(string).replace('\\\\', '\\') ret = repr(string).replace('\\\\', '\\')
ret = re.sub(r"^u?'(.*)'$", r"\1", ret) ret = re.sub(r"^u?(?P<quote>['\"])(.*)(?P=quote)$", r"\1", ret)
return to_unicode(ret) return to_unicode(ret)

View file

@ -251,8 +251,6 @@ class BUIServer(Flask):
) )
self.format_labels = [] self.format_labels = []
for format_label in format_labels: for format_label in format_labels:
if not format_label:
continue
search = re.search(r'^s(?P<separator>.)(?P<regex>.*?)(?P=separator)(?P<replace>.*?)(?P=separator)$', format_label) search = re.search(r'^s(?P<separator>.)(?P<regex>.*?)(?P=separator)(?P<replace>.*?)(?P=separator)$', format_label)
if search: if search:
self.format_labels.append((search.group('regex'), search.group('replace'))) self.format_labels.append((search.group('regex'), search.group('replace')))