From e0417f702dde5e3d8181cb89597329b256356756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Thu, 2 Jan 2014 02:02:44 +0100 Subject: [PATCH] ReplApplication.get_object(): exclude backends which does not implement '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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index e9156c97..a49fa9ed 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -261,6 +261,14 @@ class ReplApplication(Cmd, ConsoleApplication): # if backend's service returns several objects, try to find the one # with wanted ID. If not found, get the last not None object. obj = None + + # remove backends that do not have the required method + new_backend_names=[] + for backend in backend_names: + actual_backend = self.weboob.get_backend(backend) + if getattr(actual_backend, method, None) is not None: + new_backend_names.append(backend) + backend_names = tuple(new_backend_names) for backend, objiter in self.do(method, _id, backends=backend_names, fields=fields, **kargs): if objiter: obj = objiter