def create_period_from( scheduleParser ):
        SECONDS = '0'
        MINUTES = '1'
        HOURS   = '2'
        DAYS    = '3'
        WEEKS   = '4'
        MONTHS  = '5'

        period_type  = scheduleParser.getPeriodType()

        frequency    = scheduleParser.getFrequency()
        runHours     = scheduleParser.getHours()
        runDays      = scheduleParser.getRunDays()
        runMonths    = scheduleParser.getMonths()
        start_minute = scheduleParser.getMinute()
        start_hour   = scheduleParser.getHour()

        if   period_type == SECONDS:
            return None

        elif period_type == MINUTES:
            schedule = Schedule.createMinuteSchedule( frequency, runHours, runDays, start_minute )
            return PeriodMinute( schedule )

        elif period_type == HOURS:
            schedule = Schedule.createHourSchedule  ( frequency, runHours, runDays, start_minute )
            return PeriodHour  ( schedule )

        elif period_type == DAYS:
            schedule = Schedule.createDaySchedule   ( runDays, start_hour, start_minute )
            return PeriodDay   ( schedule )

        elif period_type == WEEKS:
            schedule = Schedule.createWeekSchedule   ( runDays, start_hour, start_minute )
            return PeriodWeek  ( schedule )

        elif period_type == MONTHS:
            return None

        else:
            return None
Ejemplo n.º 2
0
def createPeriod(runDaysOfWeek, startHour, startMinute):
    schedule = Schedule.createDaySchedule(runDaysOfWeek, startHour,
                                          startMinute)
    return PeriodDay(schedule)
Ejemplo n.º 3
0
 def test_creation_of_day_task(self):
     schedule = Schedule.createDaySchedule("runDaysOfWeek", "startHour",
                                           "startMinute")
     self.assertEqual(schedule.runDaysOfWeek, "runDaysOfWeek")
     self.assertEqual(schedule.startHour, "startHour")
     self.assertEqual(schedule.startMinute, "startMinute")