From 7c5e21038b9015ac315c67c13964f08ff23e10ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Mon, 13 Jan 2014 19:07:17 +0100 Subject: [PATCH] fix #1325: exclude backends that do not implement the required method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- weboob/tools/application/repl.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index e0d44b63..1d9380fd 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -342,7 +342,15 @@ class ReplApplication(Cmd, ConsoleApplication): Call Weboob.do(), passing count and selected fields given by user. """ backends = kwargs.pop('backends', None) - kwargs['backends'] = self.enabled_backends if backends is None else backends + if backends is None: + kwargs['backends'] = [] + for backend in self.enabled_backends: + actual_function = getattr(backend, function, None) + if actual_function is not None and callable(actual_function): + kwargs['backends'].append(backend) + else: + kwargs['backends'] = backends + fields = kwargs.pop('fields', self.selected_fields) or self.selected_fields if '$direct' in fields: fields = []