diff --git a/weboob/core/bcall.py b/weboob/core/bcall.py index 73ce462f..40edfce4 100644 --- a/weboob/core/bcall.py +++ b/weboob/core/bcall.py @@ -28,7 +28,7 @@ from weboob.tools.misc import get_backtrace from weboob.tools.log import getLogger -__all__ = ['BackendsCall', 'CallErrors', 'IResultsCondition', 'ResultsConditionError'] +__all__ = ['BackendsCall', 'CallErrors'] class CallErrors(Exception): @@ -44,22 +44,11 @@ class CallErrors(Exception): return self.errors.__iter__() -class IResultsCondition(object): - def is_valid(self, obj): - raise NotImplementedError() - - -class ResultsConditionError(Exception): - pass - - class BackendsCall(object): - def __init__(self, backends, condition, function, *args, **kwargs): + def __init__(self, backends, function, *args, **kwargs): """ :param backends: List of backends to call :type backends: list[:class:`BaseBackend`] - :param condition: Condition applied on results (can be None) - :type condition: :class:`IResultsCondition` :param function: backends' method name, or callable object. :type function: :class:`str` or :class:`callable` """ @@ -68,8 +57,6 @@ class BackendsCall(object): self.backends = {} for backend in backends: self.backends[backend.name] = False - # Condition - self.condition = condition # Global mutex on object self.mutex = RLock() # Event set when every backends have give their data diff --git a/weboob/core/ouiboube.py b/weboob/core/ouiboube.py index dcb9efc3..de104892 100644 --- a/weboob/core/ouiboube.py +++ b/weboob/core/ouiboube.py @@ -318,8 +318,6 @@ class Weboob(object): :type backends: list[:class:`str`] :param caps: iterate on backends which implement this caps :type caps: list[:class:`weboob.capabilities.base.IBaseCap`] - :param condition: a condition to validate results - :type condition: :class:`weboob.core.bcall.IResultsCondition` :rtype: A :class:`weboob.core.bcall.BackendsCall` object (iterable) """ backends = self.backend_instances.values() @@ -349,13 +347,12 @@ class Weboob(object): if 'caps' in kwargs: caps = kwargs.pop('caps') backends = [backend for backend in backends if backend.has_caps(caps)] - condition = kwargs.pop('condition', None) # The return value MUST BE the BackendsCall instance. Please never iterate # here on this object, because caller might want to use other methods, like # wait() on callback_thread(). # Thanks a lot. - return BackendsCall(backends, condition, function, *args, **kwargs) + return BackendsCall(backends, function, *args, **kwargs) def schedule(self, interval, function, *args): """ diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index 4c87ce8c..2d10ea12 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -305,7 +305,6 @@ class ReplApplication(Cmd, ConsoleApplication): """ backends = kwargs.pop('backends', None) kwargs['backends'] = self.enabled_backends if backends is None else backends - kwargs['condition'] = self.condition fields = kwargs.pop('fields', self.selected_fields) or self.selected_fields if '$direct' in fields: fields = [] @@ -449,10 +448,7 @@ class ReplApplication(Cmd, ConsoleApplication): This method can be overrided to support more exceptions types. """ - if isinstance(error, ResultsConditionError): - print >>sys.stderr, u'Error(%s): condition error: %s' % (backend.name, error) - else: - return super(ReplApplication, self).bcall_error_handler(backend, error, backtrace) + return super(ReplApplication, self).bcall_error_handler(backend, error, backtrace) def bcall_errors_handler(self, errors, ignore=()): if self.interactive: diff --git a/weboob/tools/application/results.py b/weboob/tools/application/results.py index 9c1970a4..4ede3d29 100644 --- a/weboob/tools/application/results.py +++ b/weboob/tools/application/results.py @@ -18,11 +18,16 @@ # along with weboob. If not, see . -from weboob.core.bcall import IResultsCondition, ResultsConditionError - - __all__ = ['ResultsCondition', 'ResultsConditionError'] +class IResultsCondition(object): + def is_valid(self, obj): + raise NotImplementedError() + + +class ResultsConditionError(Exception): + pass + class Condition(object): def __init__(self, left, op, right):