datasource: fix get_id_by_option_text with None result (#67409)
gitea-wip/wcs/pipeline/head Build started...
Details
gitea-wip/wcs/pipeline/head Build started...
Details
This commit is contained in:
parent
4932d67265
commit
00326aca67
|
@ -12,6 +12,7 @@ from wcs.blocks import BlockDef
|
|||
from wcs.carddef import CardDef
|
||||
from wcs.data_sources import NamedDataSource
|
||||
from wcs.formdef import FormDef
|
||||
from wcs.qommon import misc
|
||||
from wcs.wf.form import WorkflowFormFieldsFormDef
|
||||
from wcs.workflows import Workflow
|
||||
|
||||
|
@ -1182,6 +1183,14 @@ def test_field_live_item_datasource_prefill_with_request_with_q(urlopen, pub):
|
|||
# check it has ?q=
|
||||
assert urlopen.call_args[0][0] == 'http://remote.example.net/json?plop=&q=deux'
|
||||
|
||||
urlopen.side_effect = misc.ConnectionError('...')
|
||||
# no error
|
||||
app.post(
|
||||
'/foo/live?modified_field_id=init&prefilled_1=on&prefilled_2=on',
|
||||
params=resp.form.submit_fields(),
|
||||
status=200,
|
||||
)
|
||||
|
||||
|
||||
def test_field_live_block_string_prefill(pub, http_requests):
|
||||
FormDef.wipe()
|
||||
|
|
|
@ -217,7 +217,7 @@ def get_id_by_option_text(data_source, text_value):
|
|||
items = get_structured_items(data_source.extended_data_source, include_disabled=False)
|
||||
|
||||
# fallback to iterating on all options
|
||||
for option in items:
|
||||
for option in items or []:
|
||||
# get raw value from display value
|
||||
if option['text'] == text_value:
|
||||
return str(option['id'])
|
||||
|
|
Loading…
Reference in New Issue