Package: gtg Version: 0.3-2 Severity: normal Tags: patch 0.3 introduced a regression where fuzzy dates (mostly "now" and "soon") are no longer kept relative to the current date, but remain at the value they were initialized with at startup. (Thus somehow defeating their purpose, if gtg is left running for long periods.)
Attached is a simple patch restoring the proper behavior. -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (x86_64) Foreign Architectures: amd64 Kernel: Linux 3.10-1-amd64 (SMP w/3 CPU cores) Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= <fbri...@fbriere.net> Date: Tue, 27 Aug 2013 17:58:49 -0400 Subject: Keep fuzzy dates relative to today This partially reverts a change brought in by revision 1176.2.2. Apparently, pylint considers these lambdas useless, but they are necessary to keep fuzzy dates (mostly now/soon) relative to the current date. --- GTG/tools/dates.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GTG/tools/dates.py b/GTG/tools/dates.py index 5e3dbe7..14270e8 100644 --- a/GTG/tools/dates.py +++ b/GTG/tools/dates.py @@ -61,10 +61,10 @@ LOOKUP = { } # functions giving absolute dates for fuzzy dates + no date FUNCS = { - NOW: datetime.date.today(), - SOON: datetime.date.today() + datetime.timedelta(15), - SOMEDAY: datetime.date.max, - NODATE: datetime.date.max - datetime.timedelta(1), + NOW: lambda: datetime.date.today(), + SOON: lambda: datetime.date.today() + datetime.timedelta(15), + SOMEDAY: lambda: datetime.date.max, + NODATE: lambda: datetime.date.max - datetime.timedelta(1), } # ISO 8601 date format @@ -121,7 +121,7 @@ class Date(object): def date(self): """ Map date into real date, i.e. convert fuzzy dates """ if self.is_fuzzy(): - return FUNCS[self._fuzzy] + return FUNCS[self._fuzzy]() else: return self._real_date