when a bug occures in a module, suggest to update it

This commit is contained in:
Romain Bignon 2012-04-25 13:45:10 +02:00
commit 13524cae32

View file

@ -26,6 +26,7 @@ import os
import locale import locale
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from weboob.capabilities import UserError
from weboob.capabilities.account import ICapAccount, Account, AccountRegisterError from weboob.capabilities.account import ICapAccount, Account, AccountRegisterError
from weboob.core.backendscfg import BackendAlreadyExists from weboob.core.backendscfg import BackendAlreadyExists
from weboob.core.modules import ModuleLoadError from weboob.core.modules import ModuleLoadError
@ -272,9 +273,10 @@ class ConsoleApplication(BaseApplication):
self.weboob.repositories.install(name) self.weboob.repositories.install(name)
except ModuleInstallError, e: except ModuleInstallError, e:
print >>sys.stderr, 'Unable to install module "%s": %s' % (name, e) print >>sys.stderr, 'Unable to install module "%s": %s' % (name, e)
return 1 return False
print '' print ''
return True
def edit_backend(self, name, params=None): def edit_backend(self, name, params=None):
return self.add_backend(name, params, True) return self.add_backend(name, params, True)
@ -479,8 +481,20 @@ class ConsoleApplication(BaseApplication):
print >>sys.stderr, u'Error(%s): this feature is not supported yet by this backend.' % backend.name print >>sys.stderr, u'Error(%s): this feature is not supported yet by this backend.' % backend.name
print >>sys.stderr, u' %s To help the maintainer of this backend implement this feature,' % (' ' * len(backend.name)) print >>sys.stderr, u' %s To help the maintainer of this backend implement this feature,' % (' ' * len(backend.name))
print >>sys.stderr, u' %s please contact: %s <%s>' % (' ' * len(backend.name), backend.MAINTAINER, backend.EMAIL) print >>sys.stderr, u' %s please contact: %s <%s>' % (' ' * len(backend.name), backend.MAINTAINER, backend.EMAIL)
else: elif isinstance(error, UserError):
print >>sys.stderr, u'Error(%s): %s' % (backend.name, to_unicode(error)) print >>sys.stderr, u'Error(%s): %s' % (backend.name, to_unicode(error))
else:
print >>sys.stderr, u'Bug(%s): %s' % (backend.name, to_unicode(error))
self.weboob.repositories.update_repositories()
minfo = self.weboob.repositories.get_module_info(backend.NAME)
if minfo and not minfo.is_local() and \
minfo.version > self.weboob.repositories.versions.get(minfo.name) and \
self.ask('A new version of %s is available. Do you want to install it?' % minfo.name, default=True) and \
self.install_module(minfo):
print 'New version of module %s has been installed. Retry to call the command.' % minfo.name
return
if logging.root.level == logging.DEBUG: if logging.root.level == logging.DEBUG:
print >>sys.stderr, backtrace print >>sys.stderr, backtrace
else: else: