chiark / gitweb /
handle empty subjects when matching
[gooswapper] / gooswapper.py
index 89ec41e882609ac4c4025bfbb96e3e79714e1862..ffad0e0bbf82a697dcf573d0a0cb7ecaf0bd4c21 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']