From 1b4f9bbafa324c8c0ce12df271bfa981d4411849 Mon Sep 17 00:00:00 2001 From: Matthew Vernon Date: Tue, 23 Oct 2018 16:40:44 +0100 Subject: [PATCH] handle empty subjects when matching --- gooswapper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gooswapper.py b/gooswapper.py index 89ec41e..ffad0e0 100644 --- a/gooswapper.py +++ b/gooswapper.py @@ -342,7 +342,9 @@ def match_ex_to_gcal(ex_acct,gcal_acct,gcal_tz,events,gcal_id="primary",ignore_l timeMin=event.start.isoformat(), timeMax=event.end.isoformat()).execute() for ge in matches['items']: - if ge['summary'].strip()==event.subject.strip(): + if ( ge.get("summary") is None and event.subject is None ) or \ + ( ge.get("summary") is not None and event.subject is not None \ + and ge['summary'].strip()==event.subject.strip()): logger.info("Matching '%s' starting at %s" % (event.subject, event.start.isoformat())) event.gcal_link = ge['id'] -- 2.30.2