linkedin / pyexchange

Python wrapper for Microsoft Exchange
Apache License 2.0
153 stars 93 forks source link

Errors with Calendar Events having Attendees without an E-Mail Address #57

Open tuedelue opened 9 years ago

tuedelue commented 9 years ago

Hi together, for a fancy calendar being displayed on our institute's TV screens, we have decided using an Exchange calendar (easy integration with our other calendars and stuff) & reading needed data with PyExchange for creating some kind of displaying image. I very appreciate this easy-to-use library!

However, as soon an event gets parsed that has an attendee without an email address, a TypeError is raised. Taking a closer look into the sources, you explicitly disallow mail addresses with a None value. Is there a special reason for this? For us, this particularly does not fit our needs; there is no guarantee having 'valid' entries. I handled this by just setting an empty string in case the attendee_properties do not contain the key 'email' just before parsing the dictionary [init py, before line 504]. This works, but is kind of a quick & dirty hack.

Anyways, I just wanted to let you know about this issue. Finally, here is the trace:

Traceback (most recent call last):
  File "a.py", line 79, in <module>
    details=True
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 95, in list_events
    return Exchange2010CalendarEventList(service=self.service, start=start, end=end, details=details)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 124, in __init__
    self.load_all_details()
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 170, in load_all_details
    self._parse_response_for_all_events(response_xml)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 139, in _parse_response_for_all_events
    self._add_event(xml=soap_request.M.Items(deepcopy(item)))
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 147, in _add_event
    event = Exchange2010CalendarEvent(service=self.service, xml=xml)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/base/calendar.py", line 90, in __init__
    self._init_from_xml(xml)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 194, in _init_from_xml
    properties = self._parse_response_for_get_event(xml)
  File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 504, in _parse_response_for_get_event
    result[u'_attendees'] = self._build_resource_dictionary([ExchangeEventResponse(**attendee) for attendee in attendee_properties])
TypeError: __new__() takes exactly 6 arguments (5 given)