Commit df60e050 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_api_style: Put and get return error directly if schema doesn't match

As get and put actions are deterministic there is no need to loop
over various schemas when checking data. If there is an error it is
returned directly.
parent 87b65847
......@@ -119,6 +119,11 @@ for erp5_action_key in erp5_action_dict.keys():
response.setStatus(201)
return result
except ValueError, e:
if mode in ("put", "get"):
return logError(
"data did not match schema: %s" % e,
error_name="INPUT-DATA-DOES-NOT-MATCH-EXPECTED-DATA"
)
try:
error_dict.update(json.loads(str(e)))
except ValueError:
......
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