Mercurial > hg > gcmultimerge
comparison multimerge.py @ 37:c1764df8b65c
Update events.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 05 Jul 2016 10:49:42 +0300 |
parents | 2d7767f0fb67 |
children | 54405de302d0 |
comparison
equal
deleted
inserted
replaced
36:2d7767f0fb67 | 37:c1764df8b65c |
---|---|
418 | 418 |
419 for event in src_events: | 419 for event in src_events: |
420 # Does the event exist already in the target? | 420 # Does the event exist already in the target? |
421 if event["gcm_id"] in dst_gcm_ids: | 421 if event["gcm_id"] in dst_gcm_ids: |
422 ## Yes. Thus, we just update the event. | 422 ## Yes. Thus, we just update the event. |
423 event["status"] = "confirmed" | 423 try: |
424 new_event = service.events().update(calendarId=cfg.dest_id, eventId=event["id"], body=event).execute() | |
425 except Exception as e: | |
426 gcm_fatal("Failed to update event:\n{0}\n\nERROR: {1}\n".format(event, str(e))) | |
424 else: | 427 else: |
425 ## Event does not seem to exist. Insert new event. | 428 ## Event does not seem to exist. Insert new event. |
426 event.pop("iCalUID", None) # Remove the iCalUID, having it conflicts with event ID | 429 event.pop("iCalUID", None) # Remove the iCalUID, having it conflicts with event ID |
427 event["id"] = event["gcm_id"] # Replace Google generated ID with our own | 430 event["id"] = event["gcm_id"] # Replace Google generated ID with our own |
428 try: | 431 try: |