From 23f6a60521a8f5d0e57f4725572d3552ebba1f41 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 16 Nov 2010 14:36:39 +0100 Subject: [PATCH] raise AccountNotFound instead of returning it. --- weboob/backends/bp/pages/accountlist.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/weboob/backends/bp/pages/accountlist.py b/weboob/backends/bp/pages/accountlist.py index 23173793..3c7d02bb 100644 --- a/weboob/backends/bp/pages/accountlist.py +++ b/weboob/backends/bp/pages/accountlist.py @@ -25,9 +25,9 @@ __all__ = ['AccountList'] class AccountList(BasePage): def on_loaded(self): self.Account_List = [] - + def get_accounts_list(self): - + #Parse CCP compte_table = self.document.xpath("//table[@id='comptes']", smart_strings=False)[0] compte_ligne = compte_table.xpath("./tbody/tr") @@ -57,15 +57,10 @@ class AccountList(BasePage): return self.Account_List def get_account(self, id): - if self.Account_List: - for account in self.Account_List: - if account.id == id: - return account - return AccountNotFound() - - self.get_accounts_list() + if not self.Account_List: + self.get_accounts_list() for account in self.Account_List: if account.id == id: return account - return AccountNotFound() + raise AccountNotFound('Unable to find account: %s' % id)