From: Tomas Babej Date: Thu, 24 Dec 2015 11:05:32 +0000 (+0100) Subject: serializing: Use LazyUUIDTaskSet for dependencies X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/514a4aaf6086dfa93948ca58303009d8d400ef64?ds=inline;hp=8f39904e76a1462d81fbe80e07a82bba11035cd8 serializing: Use LazyUUIDTaskSet for dependencies --- diff --git a/tasklib/serializing.py b/tasklib/serializing.py index a9b33ee..4594285 100644 --- a/tasklib/serializing.py +++ b/tasklib/serializing.py @@ -5,6 +5,9 @@ import pytz import six import tzlocal + +from .lazy import LazyUUIDTaskSet + DATE_FORMAT = '%Y%m%dT%H%M%SZ' local_zone = tzlocal.get_localzone() @@ -181,7 +184,11 @@ class SerializingObject(object): def serialize_depends(self, value): # Return the list of uuids value = value if value is not None else set() - return ','.join(task['uuid'] for task in value) + + if isinstance(value, LazyUUIDTaskSet): + return ','.join(value._uuids) + else: + return ','.join(task['uuid'] for task in value) def deserialize_depends(self, raw_uuids): raw_uuids = raw_uuids or [] # Convert None to empty list @@ -196,7 +203,7 @@ class SerializingObject(object): else: uuids = raw_uuids - return set(self.backend.tasks.filter(' '.join(uuids))) + return LazyUUIDTaskSet(self.backend, uuids) def datetime_normalizer(self, value): """