From 8a2ba91cb471ad97094311172b86b9bf3afed725 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Thu, 6 Aug 2015 19:57:39 +0200 Subject: [PATCH] Task: Bail out if more than one task has been matched on refresh --- tasklib/task.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tasklib/task.py b/tasklib/task.py index ce915bf..cbc1192 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -753,6 +753,14 @@ class Task(TaskResource): # of newly saved tasks. Any other place in the code is fine # with using UUID only. args = [self['uuid'] or self['id'], 'export'] + output = self.warrior.execute_command(args) + + # If more than 1 task has been matched, raise exception + if len(output) > 1: + raise TaskWarriorException( + "Unique identifier {0} matches multiple tasks: {1}".format( + self['uuid'] or self['id'], output)) + new_data = json.loads(self.warrior.execute_command(args)[0]) if only_fields: to_update = dict( -- 2.39.2