new class BackendConfig to manage backend configs

This commit is contained in:
Romain Bignon 2011-05-21 10:26:57 +02:00
commit cb1372b99f
23 changed files with 234 additions and 171 deletions

View file

@ -19,8 +19,8 @@
from weboob.capabilities.bank import ICapBank, AccountNotFound
from weboob.tools.backend import BaseBackend
from weboob.tools.value import ValuesDict, Value
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword, Value
from .browser import BPBrowser
@ -35,12 +35,12 @@ class BPBackend(BaseBackend, ICapBank):
VERSION = '0.9'
LICENSE = 'AGPLv3+'
DESCRIPTION = u'La banque postale, French bank'
CONFIG = ValuesDict(Value('login', label='Account ID'),
Value('password', label='Password', masked=True))
CONFIG = BackendConfig(Value('login', label='Account ID'),
ValueBackendPassword('password', label='Password'))
BROWSER = BPBrowser
def create_default_browser(self):
return self.create_browser(self.config['login'], self.config['password'])
return self.create_browser(self.config['login'].get(), self.config['password'].get())
def iter_accounts(self):
for account in self.browser.get_accounts_list():
@ -56,7 +56,7 @@ class BPBackend(BaseBackend, ICapBank):
def iter_history(self, account):
for history in self.browser.get_history(account):
yield history
def transfer(self, id_from, id_to, amount, reason=None):
from_account = self.get_account(id_from)
to_account = self.get_account(id_to)