From 829273c7a8e6cfc0b20b3f817e6e34f76a4ee35d Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 26 Dec 2015 16:53:38 +0100 Subject: [PATCH] SerializingObject: (De)Serialize the parent attribute --- tasklib/serializing.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasklib/serializing.py b/tasklib/serializing.py index ff9b977..8cdeaf2 100644 --- a/tasklib/serializing.py +++ b/tasklib/serializing.py @@ -6,7 +6,7 @@ import six import tzlocal -from .lazy import LazyUUIDTaskSet +from .lazy import LazyUUIDTaskSet, LazyUUIDTask DATE_FORMAT = '%Y%m%dT%H%M%SZ' local_zone = tzlocal.get_localzone() @@ -181,6 +181,12 @@ class SerializingObject(object): return set(tags.split(',')) if tags else set() return set(tags or []) + def serialize_parent(self, parent): + return parent['uuid'] if parent else '' + + def deserialize_parent(self, uuid): + return LazyUUIDTask(self.backend, uuid) if uuid else None + def serialize_depends(self, value): # Return the list of uuids value = value if value is not None else set() -- 2.39.2