Commit 347cac18 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Romain Courteaud

erp5_test_result: prevent crashing if client send string value

Sanitizing client data would help to prevent such issue.

/reviewed-on nexedi/erp5!92
parent f96ce9ff
...@@ -11,7 +11,11 @@ if test_result.getPortalType() == 'Test Result': ...@@ -11,7 +11,11 @@ if test_result.getPortalType() == 'Test Result':
skips=0) skips=0)
for line in test_result.objectValues(portal_type='Test Result Line'): for line in test_result.objectValues(portal_type='Test Result Line'):
for prop in edit_kw: for prop in edit_kw:
edit_kw[prop] = edit_kw[prop] + line.getProperty(prop, 0) try:
edit_kw[prop] = edit_kw[prop] + line.getProperty(prop, 0)
except TypeError as e:
context.log("", repr(e))
has_unknown_result = True
has_unknown_result = has_unknown_result or line.getStringIndex() == 'UNKNOWN' has_unknown_result = has_unknown_result or line.getStringIndex() == 'UNKNOWN'
if has_unknown_result or edit_kw['errors'] or edit_kw['failures']: if has_unknown_result or edit_kw['errors'] or edit_kw['failures']:
status = 'FAIL' status = 'FAIL'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment