ReplApplication.get_object(): exclude backends which does not implement 'method'
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
e15b2a8473
commit
e0417f702d
1 changed files with 8 additions and 0 deletions
|
|
@ -261,6 +261,14 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
# if backend's service returns several objects, try to find the one
|
# if backend's service returns several objects, try to find the one
|
||||||
# with wanted ID. If not found, get the last not None object.
|
# with wanted ID. If not found, get the last not None object.
|
||||||
obj = None
|
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):
|
for backend, objiter in self.do(method, _id, backends=backend_names, fields=fields, **kargs):
|
||||||
if objiter:
|
if objiter:
|
||||||
obj = objiter
|
obj = objiter
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue