workflows: allow complex data in webservice calls (#49697)
This commit is contained in:
parent
9444fa214a
commit
f793d4cf5c
|
@ -2227,8 +2227,8 @@ def test_webservice_with_complex_data(http_requests, pub):
|
|||
'ezt_items': 'aa, bb',
|
||||
'item_raw': 'a',
|
||||
'ezt_item_raw': 'a',
|
||||
'items_raw': "['a', 'b']",
|
||||
'ezt_items_raw': "['a', 'b']",
|
||||
'items_raw': ['a', 'b'],
|
||||
'ezt_items_raw': ['a', 'b'],
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -113,11 +113,18 @@ def call_webservice(
|
|||
# if post_data exists, payload is a dict built from it
|
||||
if method in ('PATCH', 'PUT', 'POST') and post_data:
|
||||
payload = {}
|
||||
for (key, value) in post_data.items():
|
||||
try:
|
||||
payload[key] = WorkflowStatusItem.compute(value, raises=True)
|
||||
except:
|
||||
get_publisher().notify_of_exception(sys.exc_info())
|
||||
with get_publisher().complex_data():
|
||||
for (key, value) in post_data.items():
|
||||
try:
|
||||
payload[key] = WorkflowStatusItem.compute(value,
|
||||
allow_complex=True, raises=True)
|
||||
except:
|
||||
get_publisher().notify_of_exception(sys.exc_info())
|
||||
else:
|
||||
if payload[key]:
|
||||
complex_value = get_publisher().get_cached_complex_data(payload[key])
|
||||
if complex_value:
|
||||
payload[key] = complex_value
|
||||
|
||||
# if formdata has to be sent, it's the payload. If post_data exists,
|
||||
# it's added in formdata['extra']
|
||||
|
|
Loading…
Reference in New Issue