More resilient logic in case actions in a procedure return null responses

This commit is contained in:
Fabio Manganiello 2019-01-07 00:07:45 +01:00
parent bbc3a9e82a
commit 7aefe4e520
2 changed files with 4 additions and 3 deletions

View file

@ -194,7 +194,8 @@ class Request(Message):
if self.action.startswith('procedure.'): if self.action.startswith('procedure.'):
context['n_tries'] = n_tries context['n_tries'] = n_tries
response = self._execute_procedure(**context) response = self._execute_procedure(**context)
self._send_response(response) if response is not None:
self._send_response(response)
return response return response
else: else:
(module_name, method_name) = get_module_and_method_from_action(self.action) (module_name, method_name) = get_module_and_method_from_action(self.action)

View file

@ -139,7 +139,7 @@ class Procedure(object):
context['_async'] = self._async; context['n_tries'] = n_tries context['_async'] = self._async; context['n_tries'] = n_tries
response = request.execute(**context) response = request.execute(**context)
if not self._async: if not self._async and response:
if isinstance(response.output, dict): if isinstance(response.output, dict):
for (k,v) in response.output.items(): for (k,v) in response.output.items():
context[k] = v context[k] = v
@ -147,7 +147,7 @@ class Procedure(object):
context['output'] = response.output context['output'] = response.output
context['errors'] = response.errors context['errors'] = response.errors
return response return response or Response()
class LoopProcedure(Procedure): class LoopProcedure(Procedure):