Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ This project should adhere to [Semantic Versioning](https://semver.org/spec/v2.0

## [Unreleased]

The niquests dependency has proven controversial. See https://github.com/python-caldav/caldav/issues/457 https://github.com/python-caldav/caldav/issues/530 https://github.com/jawah/niquests/issues/267 for details. While continuing work on the 2.x-series I've decided to always release two versions of caldav, one based on requests and the next one based on niquests - giving package maintainers and other parties the option to choose between niquests (which resolves some of the issues reported to the caldav library) and requests (which is mature and firmly established in the python community, although fading to irrelevance unless 3.0 is shipped soon). Master branch will use niquests, as it's more forward-leaning. I will make a new decision on this before starting work on 3.0.
### Fixes

* A search without filtering on comp-type on a calendar containing a mix of events, journals and tasks should return a mix of such. (All the examples in the RFC includes the comp-type filter, so many servers does not support this). There were a bug in the auto-detection of comp-type, so tasks would typically be wrapped as events or vice-versa. https://github.com/python-caldav/caldav/pull/540

### Other

* Example code: Basic usage examples have been brushed up, thanks to David Greaves - https://github.com/python-caldav/caldav/pull/534
* PEP 639 conforming license expression in the pyproject.toml, thanks to Marc Mueller - https://github.com/python-caldav/caldav/pull/538

## [2.0.1] - [2025-06-24]

Expand Down
13 changes: 8 additions & 5 deletions caldav/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,13 +730,16 @@ def _request_report_build_resultlist(
pdata = results[r]
if cdav.CalendarData.tag in pdata:
cdata = pdata.pop(cdav.CalendarData.tag)
if comp_class is None:
comp_class = self._calendar_comp_class_by_data(cdata)
comp_class_ = (
self._calendar_comp_class_by_data(cdata)
if comp_class is None
else comp_class
)
else:
cdata = None
if comp_class is None:
if comp_class_ is None:
## no CalendarData fetched - which is normal i.e. when doing a sync-token report and only asking for the URLs
comp_class = CalendarObjectResource
comp_class_ = CalendarObjectResource
url = URL(r)
if url.hostname is None:
# Quote when result is not a full URL
Expand All @@ -745,7 +748,7 @@ def _request_report_build_resultlist(
if self.url.join(url) == self.url:
continue
matches.append(
comp_class(
comp_class_(
self.client,
url=self.url.join(url),
data=cdata,
Expand Down
15 changes: 15 additions & 0 deletions tests/test_caldav.py
Original file line number Diff line number Diff line change
Expand Up @@ -2477,6 +2477,21 @@ def testTodoDatesearch(self):
# TODO: prod the caldav server implementers about the RFC
# breakages.

def testSearchWithoutCompType(self):
"""
Test for https://github.com/python-caldav/caldav/issues/539
"""
self.skip_on_compatibility_flag("search_needs_comptype")
self.skip_on_compatibility_flag("search_always_needs_comptype")
self.skip_on_compatibility_flag("no_todo")
self.skip_on_compatibility_flag("no_events_and_tasks_on_same_calendar")
cal = self._fixCalendar()
cal.save_todo(todo)
cal.save_event(ev1)
objects = cal.search()
assert len(objects) == 2
assert set([type(x).__name__ for x in objects]) == {"Todo", "Event"}

def testTodoCompletion(self):
"""
Will check that todo-items can be completed and deleted
Expand Down