chiark / gitweb /
re-order setup actions
authorMatthew Vernon <mv3@sanger.ac.uk>
Wed, 24 Oct 2018 15:54:21 +0000 (16:54 +0100)
committerMatthew Vernon <mv3@sanger.ac.uk>
Wed, 24 Oct 2018 15:54:21 +0000 (16:54 +0100)
This is so we can put a loop round those that we want to repeat, after
having done all the necessary login actions.

gooswapper.py

index 41dd807..23ac350 100644 (file)
@@ -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)