From 7559a4c93d85ba0136f5a3956af6aec76e875330 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Mon, 9 Apr 2012 11:23:13 +0200 Subject: [PATCH] strip all kind of spaces, check decimal values signs --- weboob/tools/capabilities/bank/transactions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/weboob/tools/capabilities/bank/transactions.py b/weboob/tools/capabilities/bank/transactions.py index 22097362..61b6c6ff 100644 --- a/weboob/tools/capabilities/bank/transactions.py +++ b/weboob/tools/capabilities/bank/transactions.py @@ -39,7 +39,7 @@ class FrenchTransaction(Transaction): """ Clean a string containing an amount. """ - return text.replace(' ', '').replace('.','') \ + return text.replace(' ', '').replace('.','').replace(u'\xa0', '') \ .replace(',','.').strip(u' \t\u20ac\xa0\x80€\n\r') def set_amount(self, credit='', debit=''): @@ -53,9 +53,9 @@ class FrenchTransaction(Transaction): debit = self.clean_amount(debit) if len(debit) > 0: - self.amount = - Decimal(debit) + self.amount = - abs(Decimal(debit)) else: - self.amount = Decimal(credit) + self.amount = abs(Decimal(credit)) def parse(self, date, raw): """ @@ -75,7 +75,7 @@ class FrenchTransaction(Transaction): In regexps, you can define this patterns: * text: part of label to store in simplified label - * category: part of label representing the category + * category: part of label representing the category * yy, mm, dd, HH, MM: date and time parts """ if not isinstance(date, (datetime.date, datetime.datetime)):