From: Tomas Babej Date: Thu, 6 Aug 2015 06:11:44 +0000 (+0200) Subject: Task: Become able to deal with IDs and UUIDs identifiers on addition [TW 2.4.5] X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/1fdf3d38f89946c7fee2efecc7d0e84c6eb82774?ds=inline Task: Become able to deal with IDs and UUIDs identifiers on addition [TW 2.4.5] --- diff --git a/tasklib/task.py b/tasklib/task.py index ba95662..ce915bf 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -677,7 +677,13 @@ class Task(TaskResource): "task: %s" % '\n'.join(id_lines)) # Circumvent the ID storage, since ID is considered read-only - self._data['id'] = int(id_lines[0].split(' ')[2].rstrip('.')) + identifier = id_lines[0].split(' ')[2].rstrip('.') + + # Identifier can be either ID or UUID for completed tasks + try: + self._data['id'] = int(identifier) + except ValueError: + self._data['uuid'] = identifier # Refreshing is very important here, as not only modification time # is updated, but arbitrary attribute may have changed due hooks