#867: Background tasks, like a one-time forked schedule
------------------------------------+---------------------------------------
 Reporter:  [EMAIL PROTECTED]  |        Owner:  anonymous
     Type:  enhancement             |       Status:  new      
 Priority:  normal                  |    Milestone:           
Component:  TurboGears              |      Version:  0.9a6    
 Severity:  normal                  |   Resolution:           
 Keywords:                          |  
------------------------------------+---------------------------------------
Comment (by kevin):

 Karl just posted this to the mailing list:

 {{{
 ....def add_datetime_task(self, action, taskname, date_time,
 processmethod, args, kw):
 ........"""Add a new task to the schedule. This provides a way to
 generate one-time
 ........   events where you know the time you want the event to occur"""
 ........now = time.time()
 ........date_time = time.mktime(date_time.timetuple())
 ........if date_time - now < 0:
 ............return None
 ........if processmethod==method.sequential:
 ............TaskClass=OneTimeTask
 ........elif processmethod==method.threaded:
 ............TaskClass = ThreadedOneTimeTask
 ........elif processmethod = method.forked:
 ............TaskClass = ForkedOneTimeTask
 ........if not args:
 ............args = []
 ........if not kw:
 ............kw = {}
 ........task = TaskClass(taskname, date_time, action, args, kw)
 ........self.schedule_task_abs(task,date_time)
 ........return task

 class OneTimeTask(Task):
 ....def __init__(self, name, date_time, action, args=None, kw=None):
 ........Task.__init__(self, name, action, args, kw)

 ....def reschedule(self, scheduler):
 ........pass
 }}}

-- 
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/867>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Tickets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---

Reply via email to