chiark / gitweb /
handle empty subjects when matching
authorMatthew Vernon <mv3@sanger.ac.uk>
Tue, 23 Oct 2018 15:40:44 +0000 (16:40 +0100)
committerMatthew Vernon <mv3@sanger.ac.uk>
Tue, 23 Oct 2018 15:40:44 +0000 (16:40 +0100)
gooswapper.py

index 89ec41e..ffad0e0 100644 (file)
@@ -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']