From a2898f63c334b487c6dbecf8bba8d311282cd5d2 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 15 Jul 2018 02:02:27 +0200 Subject: [PATCH] - Unwrap the response in the decorator if we got a Response object from the decorated plugin - No need for @action wrappers around omxplayer event handlers --- platypush/plugins/__init__.py | 3 +++ platypush/plugins/video/omxplayer.py | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platypush/plugins/__init__.py b/platypush/plugins/__init__.py index 58adfebc68..0a80819115 100644 --- a/platypush/plugins/__init__.py +++ b/platypush/plugins/__init__.py @@ -14,6 +14,9 @@ def action(f): try: output = f(*args, **kwargs) + if output and isinstance(output, Response): + errors = output.errors + output = output.output except Exception as e: if isinstance(args[0], Plugin): args[0].logger.exception(e) diff --git a/platypush/plugins/video/omxplayer.py b/platypush/plugins/video/omxplayer.py index 4ac24b26d2..a2d796a012 100644 --- a/platypush/plugins/video/omxplayer.py +++ b/platypush/plugins/video/omxplayer.py @@ -327,19 +327,16 @@ class VideoOmxplayerPlugin(Plugin): redis.send_message(msg) - @action def on_play(self): def _f(player): self.send_message(VideoPlayEvent(video=self.player.get_source())) return _f - @action def on_pause(self): def _f(player): self.send_message(VideoPauseEvent(video=self.player.get_source())) return _f - @action def on_stop(self): def _f(player): self.send_message(VideoStopEvent())