From: Rob Golding Date: Fri, 9 Jan 2015 12:37:51 +0000 (+0000) Subject: Set missing attributes back to Task._data on access X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/534403b480471617e4cf509bc085a55eadce1e49 Set missing attributes back to Task._data on access Allows appending/adding to empty lists/sets --- diff --git a/tasklib/task.py b/tasklib/task.py index d5913af..a739d25 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -126,7 +126,10 @@ class TaskResource(SerializingObject): except ValueError: pass - return self._data.get(key) or self._deserialize(key, None) + if key not in self._data: + self._data[key] = self._deserialize(key, None) + + return self._data.get(key) def __setitem__(self, key, value): if key in self.read_only_fields: