]> git.madduck.net Git - etc/taskwarrior.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Task: Do not allow starting a Task which has already been started
authorTomas Babej <tomasbabej@gmail.com>
Tue, 7 Apr 2015 19:46:41 +0000 (21:46 +0200)
committerTomas Babej <tomasbabej@gmail.com>
Tue, 7 Apr 2015 19:46:41 +0000 (21:46 +0200)
tasklib/task.py

index 1121988249f3745264f3c588a69c9cee6517fd03..9af111b06ddc8f45cf7dbfbe34fa4f64453195ca 100644 (file)
@@ -421,6 +421,12 @@ class Task(TaskResource):
         """
         pass
 
+    class ActiveTask(Exception):
+        """
+        Raised when the operation cannot be performed on the active task.
+        """
+        pass
+
     class InactiveTask(Exception):
         """
         Raised when the operation cannot be performed on an inactive task.
@@ -600,6 +606,8 @@ class Task(TaskResource):
             raise Task.CompletedTask("Cannot start a completed task")
         elif self.deleted:
             raise Task.DeletedTask("Deleted task cannot be started")
+        elif self.active:
+            raise Task.ActiveTask("Task is already active")
 
         self.warrior.execute_command([self['uuid'], 'start'])