def reset(self): logutil.info(self.name, 'Initialize') if self.time == 'Always': self._time_reserved = str(DateTime.now()) else: hour = int(self.time[0:2]) minute = int(self.time[2:4]) reserved_time = DateTime(hour=hour, minute=minute) if reserved_time < DateTime.now(): reserved_time.after(days=1) self._time_reserved = str(reserved_time)
def update_reserved_time(self): if self.time == 'Always': self._time_reserved = str(DateTime.now()) else: reserved_time = self.time_reserved reserved_time.after(days=1) self._time_reserved = str(reserved_time)
def time_reserved(self): return DateTime.from_string(self._time_reserved)
def is_reservation_time_passed(self): return self.time_reserved < DateTime.now()
def is_job_scheduled_this_weekday(self): return DateTime.now().weekday in self.weekdays
def test_from_string(self): datetime = DateTime.from_string('2015-11-25 16:07') self.assertEqual(datetime, DateTime(year=2015, month=11, day=25, hour=16, minute=7))
def _is_reserved_time_passed(self): return self.time_reserved < DateTime.now()