Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #839 (closed enhancement: wontfix)

Opened 13 years ago

Last modified 12 years ago

[PATCH] add Task.cancel as a more pythonic way of cancelling the task (scheduler)

Reported by: rob@… Owned by: anonymous
Priority: normal Milestone:
Component: TurboGears Version: 0.9a5
Severity: normal Keywords:
Cc:

Description

I have attached a patch to allow a scheduled Task to be cancelled via a class method, which is more Pythonic. Beware this patch hasn't been tested as I don't know enough about the scheduler to test it, but it's only a 3-line function alias so it should be fine.

Attachments

scheduler.diff Download (535 bytes) - added by rob@… 13 years ago.
Add Task.cancel()

Change History

Changed 13 years ago by rob@…

Add Task.cancel()

comment:1 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to wontfix

I look at this a bit differently. A scheduler is like a collection of tasks. You add a task to it. You remove a task from it. The scheduler module happens to have a singleton scheduler, which makes this possible. It doesn't exist now, but the scheduler module *should* have an "add_task" or "schedule(task)" function in it, and cancel is the logical pair for that.

Adding cancel to task really only makes sense because of the current implementation, but cancel really belongs to the scheduler, just as append and remove belong to list in Python.

Note: See TracTickets for help on using tickets.