Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 def time_reserved(self):
     return DateTime.from_string(self._time_reserved)
Exemplo n.º 4
0
 def is_reservation_time_passed(self):
     return self.time_reserved < DateTime.now()
Exemplo n.º 5
0
 def is_job_scheduled_this_weekday(self):
     return DateTime.now().weekday in self.weekdays
Exemplo n.º 6
0
    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))
Exemplo n.º 7
0
 def _is_reserved_time_passed(self):
     return self.time_reserved < DateTime.now()