workflows: remove unnecessary handling of exception in timeout_parse (#83418)

This commit is contained in:
Frédéric Péters 2024-04-06 11:22:11 +02:00
parent 5365983716
commit 617e170a92
2 changed files with 8 additions and 4 deletions

View File

@ -272,6 +272,13 @@ def test_timeout(pub):
jump.status = 'st2'
workflow.store()
# test timeout_parse
assert jump.timeout_parse(None) is None # no value, kept as is
assert jump.timeout_parse('') == '' # no value, kept as is
assert jump.timeout_parse('20 minutes') == 20 * 60
assert jump.timeout_parse('20') == 0 # not unit
assert jump.timeout_parse('error') == 0 # not a valid value
formdef = FormDef()
formdef.name = 'baz'
formdef.fields = []

View File

@ -341,10 +341,7 @@ class JumpWorkflowStatusItem(WorkflowStatusJumpItem):
return value
if self.get_expression(value)['type'] != 'text':
return value
try:
return humanduration2seconds(value)
except ValueError:
return None
return humanduration2seconds(value)
def get_computed_strings(self):
yield from super().get_computed_strings()