This required a fix in the upstream exchange library (to properly
understand the MS timezones), but now we can use the event's timezone.
def build_gcal_event_from_ex(event,gcal_tz):
gevent={}
gevent["summary"]=event.subject
def build_gcal_event_from_ex(event,gcal_tz):
gevent={}
gevent["summary"]=event.subject
+ #Use the event's timezones if possible, otherwise fall back to the
+ #target calendar timezone
+ if event._start_timezone is not None:
+ stz = event._start_timezone
+ else:
+ stz = gcal_tz
+ if event._end_timezone is not None:
+ etz = event._end_timezone
+ else:
+ etz = gcal_tz
- gevent["end"]={"date": str(event.end.astimezone(gcal_tz).date())}
- gevent["start"]={"date": str(event.start.astimezone(gcal_tz).date())}
+ gevent["end"]={"date": str(event.end.astimezone(etz).date())}
+ gevent["start"]={"date": str(event.start.astimezone(stz).date())}
- gevent["end"]={"dateTime": event.end.astimezone(gcal_tz).isoformat(),
- "timeZone": str(gcal_tz)}
- gevent["start"]={"dateTime": event.start.astimezone(gcal_tz).isoformat(),
- "timeZone": str(gcal_tz)}
+ gevent["end"]={"dateTime": event.end.astimezone(etz).isoformat(),
+ "timeZone": str(etz)}
+ gevent["start"]={"dateTime": event.start.astimezone(stz).isoformat(),
+ "timeZone": str(stz)}
if event.text_body is not None and event.text_body.strip() != '':
gevent["description"] = event.text_body
if event.location is not None:
if event.text_body is not None and event.text_body.strip() != '':
gevent["description"] = event.text_body
if event.location is not None: