]> git.madduck.net Git - etc/taskwarrior.git/blobdiff - tasklib/task.py

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:

Task: Properly handle None in serialize_due
[etc/taskwarrior.git] / tasklib / task.py
index 1fa3faa675a5022057f70261ddba8f5c1e87fc4b..5acabe0e2952ecc032002c00079586655ec9fbe1 100644 (file)
@@ -165,6 +165,8 @@ class Task(TaskResource):
         return self['uuid'] is not None or self['id'] is not None
 
     def serialize_due(self, date):
+        if not date:
+            return None
         return date.strftime(DATE_FORMAT)
 
     def deserialize_due(self, date_str):
@@ -302,7 +304,8 @@ class Task(TaskResource):
             elif field == 'depends':
                 args.append('{0}:{1}'.format(field, self.format_depends()))
             else:
-                args.append('{0}:{1}'.format(field, self._data[field]))
+                # Use empty string to substitute for None value
+                args.append('{0}:{1}'.format(field, self._data[field] or ''))
 
         # If we're modifying saved task, simply pass on all modified fields
         if self.saved: