Use find object

This commit is contained in:
Florent 2014-10-10 10:21:11 +02:00
commit 6f5f41fe57
3 changed files with 2 additions and 24 deletions

View file

@ -18,6 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.base import find_object
from weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import ValueBackendPassword, Value
@ -60,12 +61,7 @@ class CreditCooperatifModule(Module, CapBank):
def get_account(self, _id):
with self.browser:
account = self.browser.get_account(_id)
if account:
return account
else:
raise AccountNotFound()
return find_object(self.browser.get_accounts_list(), id=_id, error=AccountNotFound)
def iter_history(self, account):
with self.browser:

View file

@ -76,15 +76,6 @@ class CreditCooperatif(Browser):
return self.page.get_list()
def get_account(self, id):
assert isinstance(id, basestring)
for a in self.get_accounts_list():
if a.id == id:
return a
return None
def get_history(self, account):
data = {'accountExternalNumber': account.id}
self.location('/portail/particuliers/mescomptes/relevedesoperations.do', urllib.urlencode(data))

View file

@ -76,15 +76,6 @@ class CreditCooperatif(Browser):
return self.page.get_list()
def get_account(self, id):
assert isinstance(id, basestring)
for a in self.get_accounts_list():
if a.id == id:
return a
return None
def _get_history(self, link):
self.location(link)