From 8b2ced6dc5992c8cb06e2691ed687e359378c7a4 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 7 Nov 2013 09:15:58 +0100 Subject: [PATCH] Do not return None objects on get_object Fix the "bug" of passing urls to videoob with multiple backends. --- weboob/tools/application/repl.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index 27623b37..673e3261 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -235,11 +235,13 @@ class ReplApplication(Cmd, ConsoleApplication): backend_names = (backend_name,) if backend_name is not None else self.enabled_backends # if backend's service returns several objects, try to find the one - # with wanted ID. If not found, get the last object. + # with wanted ID. If not found, get the last not None object. obj = None - for backend, obj in self.do(method, _id, backends=backend_names, fields=fields, **kargs): - if obj and obj.id == _id: - return obj + for backend, objiter in self.do(method, _id, backends=backend_names, fields=fields, **kargs): + if objiter: + obj = objiter + if objiter.id == _id: + return obj return obj def get_object_list(self, method=None, *args, **kwargs):