mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Merge 52f6f48f03
into 497ea8a4af
This commit is contained in:
commit
f8b8dce71c
1 changed files with 23 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import json
|
||||||
import re
|
import re
|
||||||
import errno
|
import errno
|
||||||
import logging
|
import logging
|
||||||
|
@ -314,25 +314,29 @@ class _ActionsMapPlugin:
|
||||||
for a in args:
|
for a in args:
|
||||||
params[a] = True
|
params[a] = True
|
||||||
|
|
||||||
# Append other request params
|
if request.content_type == "application/json":
|
||||||
req_params = list(request.params.dict.items())
|
# Manage in REST with JSON content mode
|
||||||
# TODO test special chars in filename
|
params.update(json.loads(list(request.params.dict.keys())[0]))
|
||||||
req_params += list(request.files.dict.items())
|
else:
|
||||||
for k, v in req_params:
|
# Append other request params
|
||||||
v = _format(v)
|
req_params = list(request.params.dict.items())
|
||||||
if k not in params.keys():
|
# TODO test special chars in filename
|
||||||
params[k] = v
|
req_params += list(request.files.dict.items())
|
||||||
else:
|
for k, v in req_params:
|
||||||
curr_v = params[k]
|
v = _format(v)
|
||||||
# Append param value to the list
|
if k not in params.keys():
|
||||||
if not isinstance(curr_v, list):
|
params[k] = v
|
||||||
curr_v = [curr_v]
|
|
||||||
if isinstance(v, list):
|
|
||||||
for i in v:
|
|
||||||
curr_v.append(i)
|
|
||||||
else:
|
else:
|
||||||
curr_v.append(v)
|
curr_v = params[k]
|
||||||
params[k] = curr_v
|
# Append param value to the list
|
||||||
|
if not isinstance(curr_v, list):
|
||||||
|
curr_v = [curr_v]
|
||||||
|
if isinstance(v, list):
|
||||||
|
for i in v:
|
||||||
|
curr_v.append(i)
|
||||||
|
else:
|
||||||
|
curr_v.append(v)
|
||||||
|
params[k] = curr_v
|
||||||
|
|
||||||
# Process the action
|
# Process the action
|
||||||
return callback((request.method, context.rule), params)
|
return callback((request.method, context.rule), params)
|
||||||
|
|
Loading…
Add table
Reference in a new issue