From: Matthew Vernon Date: Wed, 24 Oct 2018 15:54:21 +0000 (+0100) Subject: re-order setup actions X-Git-Tag: v0.1~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~matthewv/git?p=gooswapper;a=commitdiff_plain;h=0d97ee2b15ccaf8aa127be65ff85cfab3b0ae221 re-order setup actions This is so we can put a loop round those that we want to repeat, after having done all the necessary login actions. --- diff --git a/gooswapper.py b/gooswapper.py index 41dd807..23ac350 100644 --- a/gooswapper.py +++ b/gooswapper.py @@ -418,19 +418,22 @@ def main(): gcal_id = "primary" else: gcal_id = args.gcalid + + #log in to the accounts + ex_account = ex_login(args.exchuser,args.exchemail, + ".gooswapper_exch_conf.dat") + gcal_account = gcal_login(args) + gcal_tz = get_gcal_timezone(gcal_account,gcal_id) + + try: with open(cachepath,"rb") as f: cache = pickle.load(f) except FileNotFoundError: cache = None - ex_account = ex_login(args.exchuser,args.exchemail, - ".gooswapper_exch_conf.dat") current = get_ex_events(ex_account.calendar) - gcal_account = gcal_login(args) - gcal_tz = get_gcal_timezone(gcal_account,gcal_id) - if cache is not None: added,deleted,changed = ex_event_changes(cache,current) add_ex_to_gcal(ex_account,gcal_account,gcal_tz,current,added,gcal_id)