From 8e4454e14f2b4b96db026fe3e866d070feb9576c Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 17 Nov 2012 17:00:09 +0100 Subject: [PATCH] fix parsing accounts when there are interlines --- modules/bred/pages.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/bred/pages.py b/modules/bred/pages.py index de07365a..b81c6648 100644 --- a/modules/bred/pages.py +++ b/modules/bred/pages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from decimal import Decimal +from decimal import Decimal, InvalidOperation import re from weboob.tools.browser import BasePage @@ -80,7 +80,14 @@ class AccountsPage(BredBasePage): cols = tr.findall('td') - amount = sum([Decimal(txt.strip(' EUR').replace(' ', '').replace(',', '.')) for txt in cols[-1].itertext() if len(txt.strip()) > 0]) + if len(cols) < 2: + continue + + try: + amount = sum([Decimal(txt.strip(' EUR').replace(' ', '').replace(',', '.')) for txt in cols[-1].itertext() if len(txt.strip()) > 0]) + except InvalidOperation: + continue + a = cols[0].find('a') if a is None: # this line is a cards line. attach it on the first account.