fix output when no backends is configured
This commit is contained in:
parent
d1f805145d
commit
54f9220555
1 changed files with 11 additions and 4 deletions
|
|
@ -279,8 +279,14 @@ class ConsoleApplication(BaseApplication):
|
||||||
def load_backends(self, caps=None, names=None, *args, **kwargs):
|
def load_backends(self, caps=None, names=None, *args, **kwargs):
|
||||||
loaded_backends = BaseApplication.load_backends(self, caps, names, *args, **kwargs)
|
loaded_backends = BaseApplication.load_backends(self, caps, names, *args, **kwargs)
|
||||||
if not loaded_backends:
|
if not loaded_backends:
|
||||||
logging.error(u'Cannot start application: no configured backend was found.\nHere is a list of all available backends:')
|
print 'Cannot start application: no configured backend was found.'
|
||||||
from weboob.applications.weboobcfg import WeboobCfg
|
try:
|
||||||
|
from weboob.applications.weboobcfg import WeboobCfg
|
||||||
|
except ImportError:
|
||||||
|
print 'Please edit ~/.weboob/backends to add backends'
|
||||||
|
return
|
||||||
|
|
||||||
|
print '\nHere is a list of all available backends:'
|
||||||
weboobcfg = WeboobCfg()
|
weboobcfg = WeboobCfg()
|
||||||
weboobcfg.options, args = weboobcfg._parser.parse_args([])
|
weboobcfg.options, args = weboobcfg._parser.parse_args([])
|
||||||
weboobcfg._handle_app_options()
|
weboobcfg._handle_app_options()
|
||||||
|
|
@ -289,12 +295,13 @@ class ConsoleApplication(BaseApplication):
|
||||||
caps = (caps,)
|
caps = (caps,)
|
||||||
caps = [(cap if isinstance(cap, basestring) else cap.__name__) for cap in caps]
|
caps = [(cap if isinstance(cap, basestring) else cap.__name__) for cap in caps]
|
||||||
weboobcfg.command_backends(*caps)
|
weboobcfg.command_backends(*caps)
|
||||||
logging.error(u'You can configure backends using the "weboob-config add" command:\nweboob-config add <name> [options..]')
|
weboobcfg.formatter.flush()
|
||||||
|
print '\nYou can configure backends with weboob-config:\n\tweboob-config add <name> [options..]'
|
||||||
with open('/dev/null', 'w') as devnull:
|
with open('/dev/null', 'w') as devnull:
|
||||||
process = subprocess.Popen(['which', 'weboob-config-qt'], stdout=devnull)
|
process = subprocess.Popen(['which', 'weboob-config-qt'], stdout=devnull)
|
||||||
return_code = process.wait()
|
return_code = process.wait()
|
||||||
if return_code == 0:
|
if return_code == 0:
|
||||||
logging.error(u'You can configure backends using the "weboob-config-qt" GUI, too.')
|
print '\nYou can configure backends using the "weboob-config-qt" GUI, too.'
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def parse_id(self, _id):
|
def parse_id(self, _id):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue