get_object supports backend's services returning lists
This commit is contained in:
parent
745b5fbd1b
commit
a98ab89671
1 changed files with 6 additions and 1 deletions
|
|
@ -214,9 +214,14 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
if caps is not None:
|
if caps is not None:
|
||||||
kargs = {'caps': caps}
|
kargs = {'caps': caps}
|
||||||
backend_names = (backend_name,) if backend_name is not None else self.enabled_backends
|
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):
|
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
|
||||||
|
return obj
|
||||||
|
|
||||||
def get_object_list(self, method=None):
|
def get_object_list(self, method=None):
|
||||||
# return cache if not empty
|
# return cache if not empty
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue