Sqlite specific code removed + some minor refactoring
@@ -679,22 +679,11 @@ class Scheduler(object):
schedule_id = uuid.UUID(row.get('id'))
- #
- # row.get('schedule_day') returns an int, say 0, from SQLite
- # and "0", as a string, from Postgres
- # We handle here this difference
- #
-
- if type(row.get('schedule_day')) is str:
- s_day = int(row.get('schedule_day')) if row.get('schedule_day').strip() else None
- else:
- s_day = int(row.get('schedule_day'))
-
schedule = self._ScheduleRow(
id=schedule_id,
name=row.get('schedule_name'),
type=int(row.get('schedule_type')),
- day=s_day,
+ day=int(row.get('schedule_day')) if row.get('schedule_day') else None,
time=schedule_time,
repeat=interval,
repeat_seconds=repeat_seconds,
@@ -1058,7 +1047,7 @@ class Scheduler(object):
if not is_new_schedule:
update_payload = PayloadBuilder() \
.SET(schedule_name=schedule.name,
- schedule_type=int(schedule.schedule_type),
+ schedule_type=schedule.schedule_type,
schedule_interval=str(schedule.repeat),
schedule_day=day if day else 0,
schedule_time=str(schedule_time) if schedule_time else '00:00:00',
@@ -1081,7 +1070,7 @@ class Scheduler(object):
if is_new_schedule:
insert_payload = PayloadBuilder() \
.INSERT(id=str(schedule.schedule_id),
- schedule_type=int(schedule.schedule_type),
+ schedule_type=schedule.schedule_type,
schedule_name=schedule.name,
schedule_interval=str(schedule.repeat),
schedule_day=day if day else 0,
