From db4330eeed925c9dc217d916a68ab1ee2aa9b083 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 20 Oct 2018 18:07:00 +0200 Subject: [PATCH] Support for (output, errors) as a tuple returned from plugin actions --- platypush/plugins/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/__init__.py b/platypush/plugins/__init__.py index 2836cdcc..041f88cf 100644 --- a/platypush/plugins/__init__.py +++ b/platypush/plugins/__init__.py @@ -14,8 +14,13 @@ def action(f): try: output = f(*args, **kwargs) if output and isinstance(output, Response): - errors = output.errors + errors = output.errors \ + if isinstance(output.errors, list) else [output.errors] output = output.output + elif isinstance(output, tuple) and len(output) == 2: + errors = output[1] \ + if isinstance(output.errors, list) else [output[1]] + output = output[0] except Exception as e: if isinstance(args[0], Plugin): args[0].logger.exception(e)