From 06848ae011529b9f9c4c4af7a9150ccd626de113 Mon Sep 17 00:00:00 2001 From: Xavier G Date: Thu, 3 May 2012 10:35:30 +0200 Subject: [PATCH] CrAgr now handles history-less accounts as found on Sud Rhone Alpes --- modules/cragr/pages/accounts_list.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/cragr/pages/accounts_list.py b/modules/cragr/pages/accounts_list.py index b5794d16..551ea729 100644 --- a/modules/cragr/pages/accounts_list.py +++ b/modules/cragr/pages/accounts_list.py @@ -74,9 +74,14 @@ class AccountsList(CragrBasePage): s = s_node.text else: # there is no link to any history page for accounts like "PEA" or "TITRES" - account.label = div.findall('br')[0].tail.strip() account._link_id = None - s = div.xpath('following-sibling::div//b')[0].text + if isinstance(div.findall('br')[0].tail, str): + account.label = div.findall('br')[0].tail.strip() + s = div.xpath('following-sibling::div//b')[0].text + else: + account.label = div.findall('br')[1].tail.strip() + account.id = div.find('span').text.strip() + s = div.xpath('.//big')[0].text account.balance = clean_amount(s) if account.label: l.append(account)