Fix calendar bugs (#1141)

This commit is contained in:
Ross Scroggs
2020-03-30 16:16:59 -07:00
committed by GitHub
parent 7ff7c71b4e
commit 490d0a7815

View File

@@ -306,7 +306,6 @@ def addOrUpdateEvent(action):
if not cal:
return
# only way for non-Google calendars to get updates is via email
timeZone = None
kwargs = {}
body = {}
if action == 'add':
@@ -353,8 +352,9 @@ def getEventAttributes(i, calendarId, cal, body, action):
i += 2
elif myarg == 'removeattendee' and action == 'update':
remove_email = sys.argv[i+1].lower()
body['attendees'] = _remove_attendee(body['attendees'],
remove_email)
if 'attendees' in body:
body['attendees'] = _remove_attendee(body['attendees'],
remove_email)
i += 2
elif myarg == 'optionalattendee':
body.setdefault('attendees', [])
@@ -367,14 +367,14 @@ def getEventAttributes(i, calendarId, cal, body, action):
elif myarg == 'description':
body['description'] = sys.argv[i+1].replace('\\n', '\n')
i += 2
elif myarg == 'replacedescription':
elif myarg == 'replacedescription' and action == 'update':
search = sys.argv[i+1]
replace = sys.argv[i+2]
body['description'] = re.sub(search, replace, body['description'])
i += 3
elif myarg == 'start':
if sys.argv[i+1].lower() == 'allday':
body['start'] = {'date': __main__.getYYYYMMDD(sys.argv[i+2])}
body['start'] = {'date': utils.get_yyyymmdd(sys.argv[i+2])}
i += 3
else:
start_time = utils.get_time_or_delta_from_now(sys.argv[i+1])
@@ -382,7 +382,7 @@ def getEventAttributes(i, calendarId, cal, body, action):
i += 2
elif myarg == 'end':
if sys.argv[i+1].lower() == 'allday':
body['end'] = {'date': __main__.getYYYYMMDD(sys.argv[i+2])}
body['end'] = {'date': utils.get_yyyymmdd(sys.argv[i+2])}
i += 3
else:
end_time = utils.get_time_or_delta_from_now(sys.argv[i+1])