Post Fri Apr 18, 2008 1:30 am

scheduler

Hi,

scheduler.py has a function weekdaytask. It needs five parameters as stated in the scheduler.py. weekdays and timeonday I figured out. You tell me what is name and action, args=None, kw=None ?

BRgds,

kNish
=====================================================
class WeekdayTask(DayTaskRescheduler, Task):
"""A task that is called at specific days in a week (1-7), at a fixed time on the day."""
def __init__(self, name, weekdays, timeonday, action, args=None, kw=None):
if type(timeonday) not in (list,tuple) or len(timeonday) != 2:
raise TypeError("timeonday must be a 2-tuple (hour,minute)")
if type(weekdays) not in (list,tuple):
raise TypeError("weekdays must be a sequence of weekday numbers 1-7 (1 is Monday)")
DayTaskRescheduler.__init__(self, timeonday)
Task.__init__(self, name, action, args, kw)
self.days=weekdays

def execute(self):
# This is called every day, at the correct time. We only need to
# check if we should run this task today (this day of the week).
weekday=time.localtime().tm_wday+1
if weekday in self.days:
self.action(*self.args, **self.kw)
========================================================