From: Tomas Babej Date: Sat, 17 Jan 2015 09:46:05 +0000 (+0100) Subject: Task: Make sure empty values are not passed to TW via hooks X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/a0df8b516ffc77612d4ef8193f2bd5dd696916fa?ds=sidebyside;hp=-c Task: Make sure empty values are not passed to TW via hooks --- a0df8b516ffc77612d4ef8193f2bd5dd696916fa 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):