From a0df8b516ffc77612d4ef8193f2bd5dd696916fa Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 17 Jan 2015 10:46:05 +0100 Subject: [PATCH 1/1] Task: Make sure empty values are not passed to TW via hooks --- tasklib/task.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tasklib/task.py b/tasklib/task.py index 040c15b..0b18a14 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -471,8 +471,13 @@ class Task(TaskResource): """ # We need to remove spaces for TW-1504, use custom separators - data = dict((key, self._serialize(key, value)) - for key, value in six.iteritems(self._data)) + data_tuples = ((key, self._serialize(key, value)) + for key, value in six.iteritems(self._data)) + + # Empty string denotes empty serialized value, we do not want + # to pass that to TaskWarrior. + data_tuples = filter(lambda t: t[1] is not '', data_tuples) + data = dict(data_tuples) return json.dumps(data, separators=(',',':')) class TaskFilter(SerializingObject): -- 2.39.5