X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/blobdiff_plain/57c5057d9885ce0020fca03b83d1c75f6143fdc3..b28ec3e9b03f1595eaf4bb82ef1f01c3c4d1c2b6:/tasklib/task.py?ds=inline diff --git a/tasklib/task.py b/tasklib/task.py index 85ba042..80f08e9 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -52,6 +52,19 @@ class Task(object): return None return datetime.datetime.strptime(date_str, DATE_FORMAT) + def serialize_annotations(self, annotations): + ann_list = list(annotations) + for ann in ann_list: + ann['entry'] = ann['entry'].strftime(DATE_FORMAT) + return ann_list + + def deserialize_annotations(self, annotations): + ann_list = list(annotations) + for ann in ann_list: + ann['entry'] = datetime.datetime.strptime( + ann['entry'], DATE_FORMAT) + return ann_list + def regenerate_uuid(self): self['uuid'] = str(uuid.uuid4())