From 2a9978989a0876634a28150c690a725560ce7147 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 8 Oct 2013 18:33:49 +0200 Subject: [PATCH] fix crash when there are only three columns in card transactions list --- modules/cragr/web/pages.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/cragr/web/pages.py b/modules/cragr/web/pages.py index 556231ef..9b6854c9 100644 --- a/modules/cragr/web/pages.py +++ b/modules/cragr/web/pages.py @@ -178,8 +178,11 @@ class CardsPage(BasePage): for i, line in enumerate(lines): is_balance = line.xpath('./td/@class="cel-texte cel-neg"') - [date, label, _, amount] = [self.parser.tocleanstring(td) - for td in line.xpath('./td')] + # It is possible to have three or four columns. + cols = [self.parser.tocleanstring(td) for td in line.xpath('./td')] + date = cols[0] + label = cols[1] + amount = cols[-1] t = Transaction(i) t.set_amount(amount)