From bf177f71ad3f4097612abddead77d0fc34a5a6fe Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Wed, 16 Jan 2013 11:44:25 +0100 Subject: [PATCH] fix parsing card pages in special fucking cases --- modules/cic/browser.py | 3 ++- modules/cic/pages.py | 4 ++-- modules/creditmutuel/browser.py | 3 ++- modules/creditmutuel/pages.py | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/cic/browser.py b/modules/cic/browser.py index d21d5882..11207720 100644 --- a/modules/cic/browser.py +++ b/modules/cic/browser.py @@ -130,7 +130,8 @@ class CICBrowser(BaseBrowser): # useful with 12 -> 1 if int(args['mois']) < month: month = month + 1 - month = int(args['mois']) + else: + month = int(args['mois']) for tr in self.list_operations(card_link): if month > last_debit: diff --git a/modules/cic/pages.py b/modules/cic/pages.py index 32270d78..a9a91d50 100644 --- a/modules/cic/pages.py +++ b/modules/cic/pages.py @@ -154,7 +154,7 @@ class CardPage(OperationsPage): def get_history(self): index = 0 for tr in self.document.xpath('//table[@class="liste"]/tbody/tr'): - tds = tr.findall('td') + tds = tr.findall('td')[:4] if len(tds) < 4: continue @@ -166,7 +166,7 @@ class CardPage(OperationsPage): raw=u' '.join(parts)) tr.type = tr.TYPE_CARD - tr.set_amount(tds[-1].text.rstrip('EUR')) + tr.set_amount(tds[-1].text) yield tr class NoOperationsPage(OperationsPage): diff --git a/modules/creditmutuel/browser.py b/modules/creditmutuel/browser.py index 98a865d5..5b145102 100644 --- a/modules/creditmutuel/browser.py +++ b/modules/creditmutuel/browser.py @@ -130,7 +130,8 @@ class CreditMutuelBrowser(BaseBrowser): # useful with 12 -> 1 if int(args['mois']) < month: month = month + 1 - month = int(args['mois']) + else: + month = int(args['mois']) for tr in self.list_operations(card_link): if month > last_debit: diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index 36594dd0..0c5e8e9f 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -154,7 +154,7 @@ class CardPage(OperationsPage): def get_history(self): index = 0 for tr in self.document.xpath('//table[@class="liste"]/tbody/tr'): - tds = tr.findall('td') + tds = tr.findall('td')[:4] if len(tds) < 4: continue @@ -166,7 +166,7 @@ class CardPage(OperationsPage): raw=u' '.join(parts)) tr.type = tr.TYPE_CARD - tr.set_amount(tds[-1].text.rstrip('EUR')) + tr.set_amount(tds[-1].text) yield tr class NoOperationsPage(OperationsPage):