From 505a5e9fef693aef684dca898c9922825e1af5f9 Mon Sep 17 00:00:00 2001 From: Florent Date: Mon, 16 Dec 2013 15:18:52 +0100 Subject: [PATCH] Add date to filter of expression closes #1308 It is now possible to get a history in a range of date with something like: boobank history CC-1234@ing --condition "date>2013-12-01 AND date<2013-12-8" It displays transactions done betwenn the 2th and the 7th december. --- weboob/tools/application/results.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/weboob/tools/application/results.py b/weboob/tools/application/results.py index 4ede3d29..c33c7498 100644 --- a/weboob/tools/application/results.py +++ b/weboob/tools/application/results.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . +import weboob.tools.date as date_utils +from datetime import date __all__ = ['ResultsCondition', 'ResultsConditionError'] @@ -93,7 +95,10 @@ class ResultsCondition(IResultsCondition): # We have to change the type of v, always gived as string by application typed = type(d[condition.left]) try: - tocompare = typed(condition.right) + if isinstance(d[condition.left], date_utils.date): + tocompare = date(*[int(x) for x in condition.right.split('-')]) + else: + tocompare = typed(condition.right) myeval = functions[condition.op](tocompare, d[condition.left]) except: myeval = False