fix #1325: exclude backends that do not implement the required method

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2014-01-13 19:07:17 +01:00 committed by Florent
commit 7c5e21038b

View file

@ -342,7 +342,15 @@ class ReplApplication(Cmd, ConsoleApplication):
Call Weboob.do(), passing count and selected fields given by user.
"""
backends = kwargs.pop('backends', None)
kwargs['backends'] = self.enabled_backends if backends is None else backends
if backends is None:
kwargs['backends'] = []
for backend in self.enabled_backends:
actual_function = getattr(backend, function, None)
if actual_function is not None and callable(actual_function):
kwargs['backends'].append(backend)
else:
kwargs['backends'] = backends
fields = kwargs.pop('fields', self.selected_fields) or self.selected_fields
if '$direct' in fields:
fields = []