From: Tomas Babej Date: Tue, 20 Jan 2015 22:35:42 +0000 (+0100) Subject: SerializingObject: Add missing serialize_annotations method X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/4cfaeb89fcb189bc9563a59eb72ec3f7e6231bc0?hp=a40915e62131c8828305ec59ed630c63e6abecd7 SerializingObject: Add missing serialize_annotations method --- diff --git a/tasklib/task.py b/tasklib/task.py index f482f53..d386f82 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -99,6 +99,15 @@ class SerializingObject(object): def deserialize_wait(self, value): return self.timestamp_deserializer(value) + def serialize_annotations(self, value): + value = value if value is not None else [] + serialized_annotations = [annotation.export_data() for annotation in value] + + if serialized_annotations: + return '[' + ','.join(serialized_annotations) + ']' + else: + return '' + def deserialize_annotations(self, data): return [TaskAnnotation(self, d) for d in data] if data else []