From 1103e417e1335843442b1af1f784b7e126629496 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 13 Feb 2019 23:50:40 +0100 Subject: [PATCH] Managing optional arguments properly on _exec --- platypush/plugins/music/mpd/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platypush/plugins/music/mpd/__init__.py b/platypush/plugins/music/mpd/__init__.py index b35c128b6..da7c0660b 100644 --- a/platypush/plugins/music/mpd/__init__.py +++ b/platypush/plugins/music/mpd/__init__.py @@ -43,7 +43,8 @@ class MusicMpdPlugin(MusicPlugin): self.client.connect(self.host, self.port) return self.client - def _exec(self, method, n_tries=2, *args, **kwargs): + def _exec(self, method, *args, **kwargs): + n_tries = int(kwargs.pop('n_tries')) if 'n_tries' in kwargs else 1 return_status = kwargs.pop('return_status') \ if 'return_status' in kwargs else True @@ -62,8 +63,9 @@ class MusicMpdPlugin(MusicPlugin): self.client = None if n_tries > 0: - return self._exec(method, n_tries=n_tries-1, - return_status=return_status, *args, **kwargs) + kwargs['return_status'] = return_status + kwargs['n_tries'] = n_tries-1 + return self._exec(method, *args, **kwargs) else: return (None, str(e))