mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
comments added
This commit is contained in:
parent
730627f581
commit
771e2ef167
|
@ -45,12 +45,32 @@ def parse_html_list(dictionary, prefix='', default=None):
|
||||||
{'foo': 'hij', 'bar': 'klm'}
|
{'foo': 'hij', 'bar': 'klm'}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[{
|
||||||
|
'[0]': 'abc',
|
||||||
|
'[1]': 'def',
|
||||||
|
'[2]': 'hij'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'[3]': 'lmn',
|
||||||
|
'[4]': 'opq',
|
||||||
|
'[5]': 'rst'}
|
||||||
|
]
|
||||||
|
-->
|
||||||
|
[
|
||||||
|
'abc',
|
||||||
|
'def',
|
||||||
|
'hij',
|
||||||
|
'lmn',
|
||||||
|
'opq',
|
||||||
|
'rst',
|
||||||
|
]
|
||||||
|
|
||||||
: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)):
|
if isinstance(dictionary, (list, tuple)):
|
||||||
dictionary = str(dictionary)[1:-1]
|
dictionary = str(dictionary)[1:-1]
|
||||||
dictionary = '{' + dictionary[1:-1].replace('}', '').replace('{', '') + '}'
|
dictionary = '{' + dictionary[1:-1].replace('}', '').replace('{', '') + '}'
|
||||||
dictionary = eval(dictionary)
|
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))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user