From 783136a06befdb7fa07865d4ddd6a459d49d1049 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 17 Jan 2015 12:37:38 +0100 Subject: [PATCH] Task: Fix serialize_depends behaviour --- tasklib/task.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) -- 2.39.5