Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Event Location now works properly
Bumped version
  • Loading branch information
Alejandro Casanovas committed Jul 1, 2019
1 parent e86bb9d commit e77b35b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions O365/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,7 @@ def __init__(self, *, parent=None, con=None, **kwargs):
self.__is_all_day = cloud_data.get(cc('isAllDay'), False)
self.is_cancelled = cloud_data.get(cc('isCancelled'), False)
self.is_organizer = cloud_data.get(cc('isOrganizer'), True)
self.__location = cloud_data.get(cc('location'), {}).get(
cc('displayName'), '')
self.__location = cloud_data.get(cc('location'), {})
self.locations = cloud_data.get(cc('locations'), []) # TODO
self.online_meeting_url = cloud_data.get(cc('onlineMeetingUrl'), None)
self.__organizer = self._recipient_from_cloud(
Expand Down Expand Up @@ -897,6 +896,14 @@ def to_api_data(self, restrict_keys=None):
:rtype: dict
"""
cc = self._cc # alias
if self.__location:
if isinstance(self.__location, dict):
location = self.__location
else:
location = {cc('displayName'): self.__location}
else:
location = {cc('displayName'): ''}

data = {
cc('subject'): self.__subject,
cc('body'): {
Expand All @@ -905,7 +912,7 @@ def to_api_data(self, restrict_keys=None):
cc('start'): self._build_date_time_time_zone(self.__start),
cc('end'): self._build_date_time_time_zone(self.__end),
cc('attendees'): self.__attendees.to_api_data(),
cc('location'): {cc('displayName'): self.__location},
cc('location'): location,
cc('categories'): self.__categories,
cc('isAllDay'): self.__is_all_day,
cc('importance'): cc(self.__importance.value),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup, find_packages


VERSION = '1.1.9'
VERSION = '1.1.10'

# Available classifiers: https://pypi.org/pypi?%3Aaction=list_classifiers
CLASSIFIERS = [
Expand Down

0 comments on commit e77b35b

Please sign in to comment.