fix list input bug

This commit is contained in:
Ahmed Ossama 2021-08-04 01:55:12 +02:00
parent 98e56e0327
commit 730627f581

View File

@ -47,6 +47,11 @@ def parse_html_list(dictionary, prefix='', default=None):
:returns a list of objects, or the value specified in ``default`` if the list is empty :returns a list of objects, or the value specified in ``default`` if the list is empty
""" """
if isinstance(dictionary, (list, tuple)):
dictionary = str(dictionary)[1:-1]
dictionary = '{' + dictionary[1:-1].replace('}', '').replace('{', '') + '}'
dictionary = eval(dictionary)
ret = {} ret = {}
regex = re.compile(r'^%s\[([0-9]+)\](.*)$' % re.escape(prefix)) regex = re.compile(r'^%s\[([0-9]+)\](.*)$' % re.escape(prefix))
for field, value in dictionary.items(): for field, value in dictionary.items():