forked from platypush/platypush
More resilient logic in case actions in a procedure return null responses
This commit is contained in:
parent
bbc3a9e82a
commit
7aefe4e520
2 changed files with 4 additions and 3 deletions
|
@ -194,6 +194,7 @@ 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)
|
||||||
|
if response is not None:
|
||||||
self._send_response(response)
|
self._send_response(response)
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue