Fun with inheritance

pull/452/head
Christopher Usher 3 weeks ago
parent 4041040af0
commit acd7710fd7

@ -481,8 +481,12 @@ def main(dbconnect, sync_configs, metrics_port=8005, backdoor_port=0, media_dir=
client_secret=creds['client_secret'], client_secret=creds['client_secret'],
refresh_token=creds['refresh_token'], refresh_token=creds['refresh_token'],
) )
if config["type"] == "events": if config["type"] in ("events", "archive"):
middleware = SheetsEventsMiddleware( middleware_cls = {
"events": SheetsEventsMiddleware,
"archive": SheetsArchiveMiddleware,
}[config["type"]]
middleware = middleware_cls(
client, client,
config["sheet_id"], config["sheet_id"],
config["worksheets"], config["worksheets"],
@ -491,15 +495,6 @@ def main(dbconnect, sync_configs, metrics_port=8005, backdoor_port=0, media_dir=
shifts, shifts,
allocate_ids, allocate_ids,
) )
elif config["type"] == "archive":
middleware = SheetsArchiveMiddleware(
client,
config["sheet_id"],
config["worksheets"],
common.dateutil.parse(config["bustime_start"]),
config["edit_url"],
allocate_ids,
)
elif config["type"] == "playlists": elif config["type"] == "playlists":
middleware = SheetsPlaylistsMiddleware( middleware = SheetsPlaylistsMiddleware(
client, client,

Loading…
Cancel
Save