From 95e4e0d88743698e702ca6b9565f4ae78b0cac88 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 12 Mar 2013 11:55:34 +0100 Subject: [PATCH] fix crash on a new tab --- modules/axabanque/pages.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/axabanque/pages.py b/modules/axabanque/pages.py index 0d9caaf0..e74565de 100644 --- a/modules/axabanque/pages.py +++ b/modules/axabanque/pages.py @@ -112,6 +112,10 @@ class AccountsPage(BasePage): for table in self.document.getroot().cssselect('div#table-panorama table.table-client'): account = Account() + tds = table.xpath('./tbody/tr')[0].findall('td') + if len(tds) < 3: + continue + link = table.xpath('./tfoot//a')[0] if not 'onclick' in link.attrib: continue @@ -140,8 +144,6 @@ class AccountsPage(BasePage): else: account.currency = account.get_currency(m.group(1)) - tds = table.xpath('./tbody/tr')[0].findall('td') - account.balance = Decimal(FrenchTransaction.clean_amount(u''.join([txt.strip() for txt in tds[-1].itertext()]))) account._args = args yield account