diff --git a/weboob/applications/boobill/boobill.py b/weboob/applications/boobill/boobill.py index 177daeca..e55bd568 100644 --- a/weboob/applications/boobill/boobill.py +++ b/weboob/applications/boobill/boobill.py @@ -24,7 +24,8 @@ from decimal import Decimal from weboob.capabilities.bill import ICapBill, Detail, Subscription from weboob.tools.application.repl import ReplApplication, defaultcount from weboob.tools.application.formatters.iformatter import PrettyFormatter - +from weboob.tools.application.base import MoreResultsAvailable +from weboob.core import CallErrors __all__ = ['Boobill'] @@ -67,12 +68,28 @@ class Boobill(ReplApplication): else: l.append((id, backend_name)) + more_results = [] + not_implemented = [] + self.start_format() for id, backend in l: names = (backend,) if backend is not None else None + try: + for backend, result in self.do(method, id, backends=names): + self.format(result) + except CallErrors as errors: + for backend, error, backtrace in errors: + if isinstance(error, MoreResultsAvailable): + more_results.append(id + u'@' + backend.name) + elif isinstance(error, NotImplementedError): + if backend not in not_implemented: + not_implemented.append(backend) + else: + self.bcall_error_handler(backend, error, backtrace) - self.start_format() - for backend, result in self.do(method, id, backends=names): - self.format(result) + if len(more_results) > 0: + print >>sys.stderr, 'Hint: There are more results available for %s (use option -n or count command)' % (', '.join(more_results)) + for backend in not_implemented: + print >>sys.stderr, u'Error(%s): This feature is not supported yet by this backend.' % backend.name def do_subscriptions(self, line): """ @@ -104,6 +121,7 @@ class Boobill(ReplApplication): names = (backend,) if backend is not None else None # XXX: should be generated by backend? -Flo # XXX: no, but you should do it in a specific formatter -romain + # TODO: do it, and use exec_method here. Code is obsolete mysum = Detail() mysum.label = u"Sum" mysum.infos = u"Generated by boobill" diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index ce52c910..27623b37 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -247,7 +247,6 @@ class ReplApplication(Cmd, ConsoleApplication): if len(self.objects) > 0: return self.objects elif method is not None: - fields = None kwargs['backends'] = self.enabled_backends for backend, object in self.weboob.do(self._do_complete, None, None, method, *args, **kwargs): self.add_object(object)