diff --git a/docs/conf.py b/docs/conf.py index a6cacb8..d36eb56 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -51,9 +51,9 @@ # built documents. # # The short X.Y version. -version = '2.4.2' +version = '2.4.3' # The full version, including alpha/beta/rc tags. -release = '2.4.2' +release = '2.4.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 035bb43..7dd9d2a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ install_requirements = ['pytz', 'tzlocal'] -version = '2.4.2' +version = '2.4.3' try: import importlib diff --git a/tasklib/__init__.py b/tasklib/__init__.py index 4172240..b28e8c4 100644 --- a/tasklib/__init__.py +++ b/tasklib/__init__.py @@ -2,4 +2,4 @@ from .task import Task from .serializing import local_zone -__version__ = '2.4.2' +__version__ = '2.4.3' diff --git a/tasklib/task.py b/tasklib/task.py index c4a37a7..eed590c 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -1,12 +1,13 @@ from __future__ import print_function import copy +import datetime import importlib import json import logging import os import sys -from .serializing import SerializingObject +from .serializing import SerializingObject, local_zone DATE_FORMAT = '%Y%m%dT%H%M%SZ' REPR_OUTPUT_SIZE = 10 @@ -295,7 +296,10 @@ def deleted(self): @property def waiting(self): - return self['status'] == 'waiting' + if not self['wait']: + return False + + return self['wait'] > local_zone.localize(datetime.datetime.now()) @property def pending(self): @@ -523,7 +527,7 @@ def deleted(self): return self.filter(status=DELETED) def waiting(self): - return self.filter(status=WAITING) + return self.filter(wait__after='now') def recurring(self): return self.filter(status=RECURRING) diff --git a/tasklib/tests.py b/tasklib/tests.py index 39f146c..569134e 100644 --- a/tasklib/tests.py +++ b/tasklib/tests.py @@ -131,6 +131,16 @@ def test_waiting_non_empty(self): self.assertEqual(len(self.tw.tasks.waiting()), 1) + def test_waiting_property(self): + t = Task(self.tw, description='test task') + t.save() + self.assertFalse(t.waiting) + + t['wait'] = datetime.datetime.now() + datetime.timedelta(days=1) + t.save() + + self.assertTrue(t.waiting) + def test_recurring_empty(self): Task(self.tw, description='test task').save() self.assertEqual(len(self.tw.tasks.recurring()), 0)