]> git.madduck.net Git - etc/taskwarrior.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Add serialize/deserialize methods for annotations
authorRob Golding <rob@robgolding.com>
Wed, 17 Apr 2013 19:52:36 +0000 (20:52 +0100)
committerRob Golding <rob@robgolding.com>
Wed, 17 Apr 2013 19:52:36 +0000 (20:52 +0100)
tasklib/task.py

index 85ba04290b0f01af45334cf9b012a347f79ad6e8..80f08e99080fe28a8cb69d563659a405e1f7443d 100644 (file)
@@ -52,6 +52,19 @@ class Task(object):
             return None
         return datetime.datetime.strptime(date_str, DATE_FORMAT)
 
             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())
 
     def regenerate_uuid(self):
         self['uuid'] = str(uuid.uuid4())