From a98ab89671dbc8dee96d72701abb602669af479e Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 27 Jul 2013 14:28:10 +0200 Subject: [PATCH] get_object supports backend's services returning lists --- weboob/tools/application/repl.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index 1612f4e8..939182c1 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -214,9 +214,14 @@ class ReplApplication(Cmd, ConsoleApplication): if caps is not None: kargs = {'caps': caps} 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. + obj = None for backend, obj in self.do(method, _id, backends=backend_names, fields=fields, **kargs): - if obj: + if obj and obj.id == _id: return obj + return obj def get_object_list(self, method=None): # return cache if not empty