python-caldav / caldav

Apache License 2.0
327 stars 98 forks source link

Exception thrown in tentatively_accept_invite() #163

Open gregn610 opened 2 years ago

gregn610 commented 2 years ago

I've got a loop over what I think is a list of very similar invites but it's repeatably throwing an exception. This against a hosted Baïkal 0.9.1 server, I can provide access if that helps.

    for inbox_item in course.principal.schedule_inbox().get_items():
        # NB! No idea what I'm doing here !!!
        obj = CalendarObjectResource(client=course.ical_client, url=inbox_item[0])
        if obj.is_invite_request():
            print(f"tentatively accepting invite for {obj.icalendar_instance.subcomponents[0]['organizer']}")
            obj.tentatively_accept_invite(calendar=course.calendar)
            obj.delete()
ERROR:caldav:Deviation from expectations found.  Please raise an issue at https://github.com/python-caldav/caldav/issues or reach out to t-caldav@tobixen.no, include this error and the traceback and tell what server you are using
Traceback (most recent call last):
  File "/Users/gregn610/.pyenv/versions/3.9.4/envs/ldc3.9/lib/python3.9/site-packages/caldav/objects.py", line 1114, in get_items
    self._items = self.objects(load_objects=True)
  File "/Users/gregn610/.pyenv/versions/3.9.4/envs/ldc3.9/lib/python3.9/site-packages/caldav/objects.py", line 1037, in objects_by_sync_token
    (response, objects) = self._request_report_build_resultlist(root, props=[dav.GetEtag()], no_calendardata=True)
  File "/Users/gregn610/.pyenv/versions/3.9.4/envs/ldc3.9/lib/python3.9/site-packages/caldav/objects.py", line 740, in _request_report_build_resultlist
    response = self._query(xml, 1, 'report')
  File "/Users/gregn610/.pyenv/versions/3.9.4/envs/ldc3.9/lib/python3.9/site-packages/caldav/objects.py", line 166, in _query
    raise error.exception_by_method[query_method](errmsg(ret))
caldav.lib.error.ReportError: AuthorizationError at '415 Unsupported Media Type

b'<?xml version="1.0" encoding="utf-8"?>\n<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">\n  <s:sabredav-version>4.3.0</s:sabredav-version>\n  <s:exception>Sabre\\DAV\\Exception\\ReportNotSupported</s:exception>\n  <s:message>The {DAV:}sync-collection REPORT is not supported on this url.</s:message>\n  <d:supported-report/>\n</d:error>\n'', reason 'no reason'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/gregn610/.pyenv/versions/3.9.4/envs/ldc3.9/lib/python3.9/site-packages/caldav/lib/error.py", line 25, in assert_
    assert(condition)
AssertionError

Many thanks!

tobixen commented 2 years ago

"Unsupported media type", that's weird.

The scheduling extension (send/accept invites) is not very well-tested, found it difficult to test the code as very few calendar servers supports the extensions fully, and since I will need three accounts on the same server to fully test it.

I can't tell anything about the time frame as I'm very busy over the next few days, but if you provide me with three test accounts on the server I can try to look into it when I get time.

tobixen commented 2 years ago

I found one obvious bug in March that I fixed, but I still haven't been able to get the tests passing, and haven't had much capacity for looking into it. v0.9 is way overdue for release, so it will unfortunately be released without better support for the scheduling.

tobixen commented 2 years ago

Sorry ... I've been prioritizing other things than scheduling lately ... but I will definitively get back to this one.