Commit 87b65847 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_api_style: allDocs no longer accumulate results

* allDocs now behave like others action mode and return the result
of the match
* It allows greater customization of the output data
parent 50111a6d
...@@ -117,10 +117,7 @@ for erp5_action_key in erp5_action_dict.keys(): ...@@ -117,10 +117,7 @@ for erp5_action_key in erp5_action_dict.keys():
if mode == "post": if mode == "post":
if response.getStatus() == 200: if response.getStatus() == 200:
response.setStatus(201) response.setStatus(201)
# If not search, job is done and we can return result return result
if mode != "allDocs":
return result
result_list += result
except ValueError, e: except ValueError, e:
try: try:
error_dict.update(json.loads(str(e))) error_dict.update(json.loads(str(e)))
...@@ -143,12 +140,4 @@ if not match: ...@@ -143,12 +140,4 @@ if not match:
error_kw["detail_list"] = sorted(error_dict.items()) error_kw["detail_list"] = sorted(error_dict.items())
return logError(error_message, **error_kw) return logError(error_message, **error_kw)
if mode == "allDocs":
return json.dumps({
"$schema": "alldocs-response-schema.json",
"result_list":result_list
},
indent=2
)
raise ValueError("Unreachable code reached") raise ValueError("Unreachable code reached")
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