Skip to content

Commit b7b0ef9

Browse files
authored
* Implemented workarounds in the search for many server compatibility issues. Now it's possible to do quite much filtering logic on the client-side. (#566)
* Collation was glossed over earlier, support has been improved. It's now possible to specify if a search should be case-insensitive or case-sensitive, but as for now the case-insensitivity is only guaranteed to work for the ASCII characters. * Quite some logic "Search for ZZZ - if server supports XXX, then assert YYY" in the test code has been replaced with just "Search for ZZZ - assert YYY" * This should fix #434 * Been working more on the "compatibility hints" database * Now there is a difference between searching for a "category" string vs a "categories" set. The case-insensitive searches may be improved more; I made a new issue #567 Sorry for the jumbo-commit.
1 parent 2f22085 commit b7b0ef9

12 files changed

Lines changed: 1261 additions & 163 deletions

‎CHANGELOG.md‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
## IMPORTANT - niquests vs requests - flapping changeset
44

5-
The requests library is stagnant, from 2.0.0 niquests has been in use. It's a very tiny changeset, which resolved three github issues, fixed support for HTTP/2 and may open the door for an upcoming async proejct. While I haven't looked much "under the bonnet", niquests seems to be a major upgrade of requests. However, the niquest author has apparently failed cooperating well with some significant parts of the python community, so niquests pulls in a lot of other forked libraries as for now. Shortly after releasing 2.0 I was requested to revert back to requests and release 2.0.1. After 2.0.1, the library has been fixed so that it will always use niquests if niquests is available, and requests if niquests is not available.
5+
The requests library is stagnant, from 2.0.0 niquests has been in use. It's a very tiny changeset, which resolved three github issues (and created a new one - see https://github.com/python-caldav/caldav/issues/564), fixed support for HTTP/2 and may open the door for an upcoming async proejct. While I haven't looked much "under the bonnet", niquests seems to be a major upgrade of requests. However, the niquest author has apparently failed cooperating well with some significant parts of the python community, so niquests pulls in a lot of other forked libraries as for now. Shortly after releasing 2.0 I was requested to revert back to requests and release 2.0.1. After 2.0.1, the library has been fixed so that it will always use niquests if niquests is available, and requests if niquests is not available.
66

7-
You are encouraged to make an informed decision on weather you are most comfortable with the stable but stagnant requests, or the niquests fork. I hope to settle down on some final decision when I'm starting to work on 3.0 (which will support async requests). httpx may be an option. **Your opinion is valuable for me**. Feel free to comment on https://github.com/python-caldav/caldav/issues/457, https://github.com/python-caldav/caldav/issues/530 or https://github.com/jawah/niquests/issues/267 if you have a github account, and if not you can reach out at python-http@plann.no. (So far the most common recommendation seems to be to go for httpx.
7+
You are encouraged to make an informed decision on weather you are most comfortable with the stable but stagnant requests, or the niquests fork. I hope to settle down on some final decision when I'm starting to work on 3.0 (which will support async requests). httpx may be an option. **Your opinion is valuable for me**. Feel free to comment on https://github.com/python-caldav/caldav/issues/457, https://github.com/python-caldav/caldav/issues/530 or https://github.com/jawah/niquests/issues/267 - if you have a github account, and if not you can reach out at python-http@plann.no.
8+
9+
So far the most common recommendation seems to be to go for httpx. See also https://github.com/python-caldav/caldav/pull/565
810

911
## Meta
1012

@@ -22,27 +24,35 @@ I'm still working on "compatibility hints". Unfortunately, documentation is sti
2224
* Use `features: nextcloud` and `url: my.nextcloud.provider.eu` instead of `url: https://my.nextcloud.provider.eu/remote.php/dav`
2325
* The library will work around some known issues dependent on what feature-set it's given.
2426

25-
Searching may now be done by creating a `caldav.CalDAVSearcher` object and do a `searcher.search(cal)` instead of doing `cal.search(...)`. However, there are no plans to deprecate the latter method. Major refactoring work has been done here, and some of the logic has been moved to a new package icalendar-searcher.
27+
Searching may now be done by creating a `caldav.CalDAVSearcher` object and do a `searcher.search(cal)` instead of doing `cal.search(...)`. While there are no plans to deprecate the latter method, the new logic offers more features. Major refactoring work has been done here, and some of the logic has been moved to a new package icalendar-searcher.
2628

27-
## Breaking Changes
29+
### Breaking Changes
2830

29-
Some code has been split out into a new package - `icalendar-searcher`. This does not affect compatibility, hence it's not needed to bump the major version number, but if you manage the dependencies manually it may still cause things to break.
31+
* Some code has been split out into a new package - `icalendar-searcher`. This does not affect compatibility, hence it's not needed to bump the major version number, but if you manage the dependencies manually it may still cause things to break.
32+
* Lots of work has been put in to work around server-quirks, ensuring more consistent search-results regardless of what server is in use. For some use cases this may be a breaking change as search results from certain servers may have changed (see more below).
3033

31-
## Deprecations
34+
### Deprecations
3235

3336
* `Event.expand_rrule` will be removed in some future release, unless someone protests.
3437
* `Event.split_expanded` too. Both of them were used internally, now it's not. It's dead code, most lkely nobody and nothing is using them.
3538

36-
## Changed
39+
### Changed
3740

3841
* Major refactoring! Some of the logic has been pushed out of the CalDAV package and into a new package, icalendar-searcher. New logic for doing client-side filtering of search results have also been added to that package.
42+
* **Server compatibility improvements**: Significant work-arounds added for inconsistent CalDAV server behavior, aiming for consistent search results regardless of the server in use. Many of these work-arounds require proper server compatibility configuration via the `features` / `compatibility_hints` system. This may be a **breaking change** for some use cases, as backward-bug-compatibility is not preserved - searches may return different results if the previous behavior was relying on server quirks.
3943

40-
## Added
44+
### Added
4145

4246
* The client connection parameter `features` may now simply be a string label referencing a well-known server or cloud solution - like `features: posteo`. https://github.com/python-caldav/caldav/pull/561
4347
* The client connection parameter `url` is no longer needed when referencing a well-known cloud solution. https://github.com/python-caldav/caldav/pull/561
4448
* The client connection parameter `url` may contain just the domain name (without any slashes) and the URL will be constructed, if referencing a well-known caldav server implementation. https://github.com/python-caldav/caldav/pull/561
4549
* New interface for searches. `mysearcher = caldav.CalDAVSearcher(...) ; mysearcher.add_property_filter(...) ; mysearcher.search(calendar)`. May be useful for complicated searches.
50+
* **Collation support for CalDAV text-match queries (RFC 4791 § 9.7.5)**: CalDAV searches now properly pass collation attributes to the server, enabling case-insensitive searches and Unicode-aware text matching. The `CalDAVSearcher.add_property_filter()` method now accepts `case_sensitive` and `collation` parameters. Supported collations include:
51+
- `i;octet` (case-sensitive, binary comparison) - default
52+
- `i;ascii-casemap` (case-insensitive for ASCII characters, RFC 4790)
53+
- `i;unicode-casemap` (Unicode case-insensitive, RFC 5051 - server support may vary)
54+
* Client-side filtering method: `CalDAVSearcher.filter()` provides comprehensive client-side filtering, expansion, and sorting of calendar objects with full timezone preservation support.
55+
* Example code: New `examples/collation_usage.py` demonstrates case-sensitive and case-insensitive calendar searches.
4656

4757
## [2.1.2] - [2025-11-08]
4858

‎caldav/collection.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,6 @@ def search(
913913
alias = key
914914
if key == "class_": ## because class is a reserved word
915915
alias = "class"
916-
if key == "category": ## TODO: should we have special logic?
917-
alias = "categories"
918916
if key == "no_category":
919917
alias = "no_categories"
920918
if key == "no_class_":

0 commit comments

Comments
 (0)