From 679177d4506b36be29da0ad1bd2202903aee326a Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Fri, 9 Mar 2012 13:20:47 +0100 Subject: [PATCH] store transactions dates as datetime.date objects --- modules/bp/pages/accounthistory.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/bp/pages/accounthistory.py b/modules/bp/pages/accounthistory.py index e7e4bc01..648a07e1 100644 --- a/modules/bp/pages/accounthistory.py +++ b/modules/bp/pages/accounthistory.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright(C) 2010-2011 Nicolas Duhamel +# Copyright(C) 2010-2012 Nicolas Duhamel # # This file is part of weboob. # @@ -18,6 +18,7 @@ # along with weboob. If not, see . +from datetime import date import re from weboob.capabilities.bank import Transaction @@ -37,9 +38,12 @@ class AccountHistory(BasePage): for mvt in mvt_ligne: operation = Transaction(len(operations)) - operation.date = mvt.xpath("./td/span")[0].text + + d = mvt.xpath("./td/span")[0].text.strip().split('/') + operation.date = date(*reversed([int(x) for x in d])) + tmp = mvt.xpath("./td/span")[1] - operation.raw = unicode(self.parser.tocleanstring(tmp)) + operation.raw = unicode(self.parser.tocleanstring(tmp).strip()) r = re.compile(r'\d+')