From 534403b480471617e4cf509bc085a55eadce1e49 Mon Sep 17 00:00:00 2001 From: Rob Golding Date: Fri, 9 Jan 2015 12:37:51 +0000 Subject: [PATCH] Set missing attributes back to Task._data on access Allows appending/adding to empty lists/sets --- tasklib/task.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: -- 2.39.2