From: Tomas Babej Date: Mon, 23 May 2016 20:12:36 +0000 (+0200) Subject: backends: Do not perform field deletion for new tasks X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/f881626c51f4a954f0330ef141b1b3ff944e35df?hp=ce0455c6318ad4623f10a0d35aea2d929fc57fdd backends: Do not perform field deletion for new tasks --- diff --git a/tasklib/backends.py b/tasklib/backends.py index 6e7d918..fd3069c 100644 --- a/tasklib/backends.py +++ b/tasklib/backends.py @@ -171,11 +171,17 @@ class TaskWarrior(Backend): if task.saved: for field in task._modified_fields: add_field(field) + # For new tasks, pass all fields that make sense else: for field in task._data.keys(): + # We cannot set stuff that's read only (ID, UUID, ..) if field in task.read_only_fields: continue + # We do not want to do field deletion for new tasks + if task._data[field] is None: + continue + # Otherwise we're fine add_field(field) return args