From 3ac1824307e8edef91cb38b3fa58f9d8058b5725 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Mon, 7 Jan 2013 15:21:22 +0100 Subject: [PATCH] fix parsing amounts in special cases --- modules/cic/pages.py | 10 +++------- modules/creditmutuel/pages.py | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/modules/cic/pages.py b/modules/cic/pages.py index db852d7c..32270d78 100644 --- a/modules/cic/pages.py +++ b/modules/cic/pages.py @@ -141,13 +141,9 @@ class OperationsPage(BasePage): operation.parse(date=tds[0].text, raw=u' '.join(parts)) - if tds[-1].text is not None and len(tds[-1].text) > 2: - s = tds[-1].text.strip() - elif tds[-2].text is not None and len(tds[-2].text) > 2: - s = tds[-2].text.strip() - else: - s = "0" - operation.set_amount(s.rstrip('EUR')) + credit = u''.join([txt.strip() for txt in tds[-1].itertext()]) + debit = u''.join([txt.strip() for txt in tds[-2].itertext()]) + operation.set_amount(credit, debit) yield operation def next_page_url(self): diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index 3a533a07..36594dd0 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -141,13 +141,9 @@ class OperationsPage(BasePage): operation.parse(date=tds[0].text, raw=u' '.join(parts)) - if tds[-1].text is not None and len(tds[-1].text) > 2: - s = tds[-1].text.strip() - elif tds[-2].text is not None and len(tds[-2].text) > 2: - s = tds[-2].text.strip() - else: - s = "0" - operation.set_amount(s.rstrip('EUR')) + credit = u''.join([txt.strip() for txt in tds[-1].itertext()]) + debit = u''.join([txt.strip() for txt in tds[-2].itertext()]) + operation.set_amount(credit, debit) yield operation def next_page_url(self):