From 7b0f22cf6cf519ece57e5282412669f460859293 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 8 Aug 2015 19:51:11 +0200 Subject: [PATCH 1/1] Task: Move TW-specific deletion logic into TW backend --- tasklib/backends.py | 3 +++ tasklib/task.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tasklib/backends.py b/tasklib/backends.py index ad5bd6b..6bf11bb 100644 --- a/tasklib/backends.py +++ b/tasklib/backends.py @@ -201,3 +201,6 @@ class TaskWarrior(object): # altering the data before saving task.refresh(after_save=True) + def delete_task(self, task): + self.execute_command([task['uuid'], 'delete']) + diff --git a/tasklib/task.py b/tasklib/task.py index 7c6dff8..61f944a 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -586,7 +586,7 @@ class Task(TaskResource): if self.deleted: raise Task.DeletedTask("Task was already deleted") - self.warrior.execute_command([self['uuid'], 'delete']) + self.backend.delete_task(self) # Refresh the status again, so that we have updated info stored self.refresh(only_fields=['status', 'start', 'end']) -- 2.39.5