misc: add feature flag to disable complex data support (#49968)

This commit is contained in:
Frédéric Péters 2021-01-13 13:10:07 +01:00 committed by Thomas NOEL
parent ea64284843
commit b4e6eafe16
3 changed files with 14 additions and 1 deletions

View File

@ -2270,6 +2270,17 @@ def test_webservice_with_complex_data(http_requests, pub):
'forloop_items_raw': 'a|b|',
}
# check it's possible to disable complex data support
pub.load_site_options()
pub.site_options.set('options', 'complex-data', 'false')
with get_publisher().complex_data():
item.perform(formdata)
assert http_requests.get_last('url') == 'http://remote.example.net'
assert http_requests.get_last('method') == 'POST'
payload = json.loads(http_requests.get_last('body'))
assert payload['items_raw'] == repr(['a', 'b'])
def test_timeout(two_pubs):
workflow = Workflow(name='timeout')

View File

@ -386,7 +386,8 @@ class WcsPublisher(StubWcsPublisher):
@contextmanager
def complex_data(self):
self.complex_data_cache = {}
if self.has_site_option('complex-data'):
self.complex_data_cache = {}
try:
yield True
finally:

View File

@ -368,6 +368,7 @@ class QommonPublisher(Publisher, object):
'mail-templates': True,
'external-workflow': True,
'fields-blocks': True,
'complex-data': True,
}
if self.site_options is None:
self.load_site_options()