From: Tomas Babej Date: Sat, 17 Jan 2015 11:37:38 +0000 (+0100) Subject: Task: Fix serialize_depends behaviour X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/783136a06befdb7fa07865d4ddd6a459d49d1049 Task: Fix serialize_depends behaviour --- diff --git a/tasklib/task.py b/tasklib/task.py index 8ee77fd..9b3626d 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -110,9 +110,10 @@ class SerializingObject(object): return tags.split(',') if tags else [] return tags or [] - def serialize_depends(self, cur_dependencies): + def serialize_depends(self, value): # Return the list of uuids - return ','.join(task['uuid'] for task in cur_dependencies) + value = value if value is not None else set() + return ','.join(task['uuid'] for task in value) def deserialize_depends(self, raw_uuids): raw_uuids = raw_uuids or '' # Convert None to empty string @@ -329,7 +330,7 @@ class Task(TaskResource): def serialize_depends(self, cur_dependencies): # Check that all the tasks are saved - for task in cur_dependencies: + for task in (cur_dependencies or set()): if not task.saved: raise Task.NotSaved('Task \'%s\' needs to be saved before ' 'it can be set as dependency.' % task)