From: Tomas Babej Date: Thu, 15 Jan 2015 20:55:20 +0000 (+0100) Subject: Task: Do not yield corner case of fake removals as modified field X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/c54258e6a4ba9a7e56e4a81730b762ecbe97ed8c?ds=inline Task: Do not yield corner case of fake removals as modified field --- diff --git a/tasklib/task.py b/tasklib/task.py index 1ab6347..f61fb05 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -245,7 +245,15 @@ class Task(TaskResource): def _modified_fields(self): writable_fields = set(self._data.keys()) - set(self.read_only_fields) for key in writable_fields: - if self._data.get(key) != self._original_data.get(key): + new_value = self._data.get(key) + old_value = self._original_data.get(key) + + # Make sure not to mark data removal as modified field if the + # field originally had some empty value + if key in self._data and not new_value and not old_value: + continue + + if new_value != old_value: yield key @property