python-caldav / caldav

Apache License 2.0
314 stars 94 forks source link

compatibility fix: objects returned by search should always be loaded #280

Closed tobixen closed 1 year ago

tobixen commented 1 year ago

Some test broke towards some server because the server threw empty icalendar objects back at us - objects containing BEGIN:VCALENDAR and END:VCALENDAR and a little bit of metadata, but no components. This was working out earlier while the vobjects library was used to determinate if client-side expansion was needed or not, but when changing to obj.icalendar_component we got an assertion error back. Now the code is changed so that search items that have no data or no components to them will be loaded. This may cause very much longer loading times, but the decision was sort of made in 1.0.1 already - this will happen only on a few calendar servers that are breaching the RFC.

Also cleaned a bit up/refactored, to always use the new .load(only_if_unloaded=True) rather than having the if not obj.data:-logic.