add enable and disable command to weboob-config

Signed-off-by: Michael Scherer <misc@zarb.org>
Signed-off-by: Romain Bignon <romain@peerfuse.org>
This commit is contained in:
Michael Scherer 2011-05-08 16:13:50 +02:00 committed by Romain Bignon
commit 98e3da921b
2 changed files with 28 additions and 0 deletions

View file

@ -55,6 +55,9 @@ Erwan Jahier <Erwan.Jahier@imag.fr>
Laurent Dufréchou <laurent.dufrechou@gmail.com>
* Windows support.
Michael Scherer <misc@zarb.org>
* Contribution on weboob-config.
Romain Garbage <romain.garbage@gmail.com>
* Fixes for FreeBSD.

View file

@ -144,6 +144,31 @@ class WeboobCfg(ReplApplication):
print >>sys.stderr, 'Backend instance "%s" does not exist' % instance_name
return 1
def _do_toggle(self, name, state):
try:
bname, items = self.weboob.backends_config.get_backend(name)
except KeyError:
print >>sys.stderr, 'Backend instance "%s" does not exist' % name
return 1
self.weboob.backends_config.edit_backend(name, bname, {'_enabled': state})
def do_enable(self, name):
"""
enable NAME
Enable a disabled backend
"""
self._do_toggle(name, 1)
def do_disable(self, name):
"""
disable NAME
Disable a backend
"""
self._do_toggle(name, 0)
def do_edit(self, line):
"""
edit NAME