Skip to content
Open
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
4 changes: 4 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ https?://davical\.bekkenstenveien53c\.oslo\.no/.*
# browser; lychee just isn't one.
https://stackoverflow\.com/.*

# TLS certificate expired 2026-11-14 and was not renewed. Drop this
# once the site serves a valid one again.
https://devguide\.calconnect\.org/.*

# Dead or broken links we can't fix
http://fsf\.org/.*
http://oxpedia\.org/.*
Expand Down
2 changes: 1 addition & 1 deletion caldav/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def _build_calendars_from_propfind(self, list_response: Any, guess: bool = False
_raise_unless_propfind_ok(list_response)
calendar_infos = extract_calendars(list_response.results, features=self.features)
return [
Calendar(client=self, url=info.url, name=info.name, id=info.cal_id)
Calendar(client=self, url=info.url, id=info.cal_id, props=info.props)
for info in calendar_infos
]

Expand Down
17 changes: 14 additions & 3 deletions caldav/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import uuid
import warnings
from collections.abc import Generator
from dataclasses import dataclass
from dataclasses import dataclass, field
from datetime import date as _date
from datetime import datetime, timezone
from time import sleep
Expand Down Expand Up @@ -96,6 +96,8 @@ class CalendarInfo:
cal_id: str | None
name: str | None
resource_types: list[str]
#: Every property the listing answered, as ``get_properties()`` parses them
props: dict[str, Any] = field(default_factory=dict)


def _extract_calendar_id_from_url(url: str) -> str | None:
Expand Down Expand Up @@ -170,6 +172,7 @@ def _extract_calendars_from_propfind_results(
cal_id=cal_id,
name=name,
resource_types=result.properties.get("{DAV:}resourcetype", []),
props=dict(result.properties),
)
)
return calendars
Expand Down Expand Up @@ -238,7 +241,9 @@ def _calendars_from_response(self, response) -> list["Calendar"]:
response.results, features=features
)
return [
Calendar(client=self.client, url=info.url, name=info.name, id=info.cal_id, parent=self)
Calendar(
client=self.client, url=info.url, id=info.cal_id, parent=self, props=info.props
)
for info in calendar_infos
]

Expand Down Expand Up @@ -1262,12 +1267,15 @@ def _supported_components_from_response(self, response: Any, with_fallback: bool
return rfc_default

def get_supported_components(
self, with_fallback=True
self, with_fallback=True, use_cached=False
) -> "list[Any] | Coroutine[Any, Any, list[Any]]":
"""
returns a list of component types supported by the calendar, in
string format (typically ['VJOURNAL', 'VTODO', 'VEVENT'])

With ``use_cached``, a set already in ``props`` - from the
get_calendars() listing - is returned without asking the server.

RFC 4791 section 5.2.3: supported-calendar-component-set is optional.
When absent, the server MUST accept all component types, so we return
the RFC default list (trimmed by known server limitations from
Expand All @@ -1276,6 +1284,9 @@ def get_supported_components(
"""
if self.url is None:
raise ValueError("Unexpected value None for self.url")
cached = self.props.get(cdav.SupportedCalendarComponentSet.tag) if use_cached else None
if cached:
return self.client._value_or_coroutine(list(cached))
if self.is_async_client:
return self._async_get_supported_components(with_fallback)
props = [cdav.SupportedCalendarComponentSet()]
Expand Down
24 changes: 22 additions & 2 deletions caldav/compatibility_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ class FeatureSet:
"default": {"support": "full"},
"links": ["https://datatracker.ietf.org/doc/html/rfc3744#section-2", "https://datatracker.ietf.org/doc/html/rfc4918#section-9.1"],
},
"propfind.listed-members-exist": {
"description": "Every calendar a Depth: 1 PROPFIND of the calendar home lists is there: a PROPFIND of its own does not answer 404. RFC 4918 section 9.1 has a Depth: 1 PROPFIND report the members of the collection, so 'broken' is a listing naming a calendar that is not there - Bedework 5 lists a tasks/ calendar, display name and component set and all, that answers 404 when asked directly. A client that takes the listing's properties as they are hands such a calendar out, to fail when used; where this is broken, it asks each listed calendar first.",
"default": {"support": "full"},
"links": ["https://datatracker.ietf.org/doc/html/rfc4918#section-9.1"],
},
"create-calendar.with-supported-component-types": {
"description": "A MKCALENDAR naming a supported-calendar-component-set gives a calendar with that set. RFC 4791 section 5.3.1.1 has a server that cannot set a property answer 207 with 403 or 409 for it and create nothing; 'unsupported' means the calendar was created with another set (reported as another set, or not reported while an object outside the requested set can be saved to it) - Bedework 5 answers the property '200 ok' and makes a VEVENT-only calendar. When 'ungraceful', the MKCALENDAR request itself fails when a component set is specified. Whether the server then obeys the set it reports is supported-components.honoured.",
"default": {"support": "full"},
Expand Down Expand Up @@ -893,7 +898,7 @@ class FeatureSet:
"links": ["https://datatracker.ietf.org/doc/html/rfc6578#section-3.5.1"],
},
"sync-token.initial-sync": {
"description": "A sync report from an empty token lists exactly the current members of the collection: RFC 6578 section 3.4 says it MUST NOT return removed members. 'quirk' when it lists more, which a client can filter away (keep only hrefs below the collection, answered 200): Radicale lists deleted members with a 404, Stalwart also lists the collection itself. The behaviour says which. The limit on an initial sync is sync-token.limit.initial-sync, which inherits from sync-token.limit rather than from this.",
"description": "A sync report from an empty token lists exactly the current members of the collection: RFC 6578 section 3.4 says it MUST NOT return removed members. 'quirk' when it lists more, which a client can filter away (keep only hrefs below the collection, answered 200): Radicale lists deleted members with a 404, Stalwart and CCS also list the collection itself. The behaviour says which. The limit on an initial sync is sync-token.limit.initial-sync, which inherits from sync-token.limit rather than from this.",
"default": {"support": "full"},
"links": ["https://datatracker.ietf.org/doc/html/rfc6578#section-3.4"],
},
Expand Down Expand Up @@ -1432,7 +1437,8 @@ def _derive_from_subfeatures(self, feature, feature_info, return_type, accept_fr
Derive parent feature status from explicitly set subfeatures.

Logic:
- Only consider subfeatures WITHOUT explicit defaults (those are independent features)
- Only consider subfeatures WITHOUT explicit defaults (subfeatures with a default are
independent features and are skipped)
- If ANY relevant subfeature has a positive status (full/quirk) → derive as that status
(any support means the parent has some support)
- If ALL relevant subfeatures are set AND all have the same negative status → use that status
Expand All @@ -1442,6 +1448,16 @@ def _derive_from_subfeatures(self, feature, feature_info, return_type, accept_fr

Returns None if no relevant subfeatures are explicitly set or if
derivation is inconclusive due to partial information.

An explicit default on a node marks it as an independent feature, one
that is probed on its own. A parent node without one is treated as a
grouping node. A grouping node whose subfeatures all have explicit
defaults (``auth``, ``http``) therefore has no verdict of its own:
nothing is derived, and unless the node or an ancestor is set in the
server's features, is_supported() answers from the type default
whatever the subfeatures say. Ask the subfeatures instead. A real
capability that lacks a default and needs its own answer should get
an explicit ``unknown`` default.
"""
if 'subfeatures' not in feature_info or not feature_info['subfeatures']:
return None
Expand Down Expand Up @@ -2197,6 +2213,10 @@ def __getattr__(name: str) -> Any:
"create-calendar.auto": {"support": "unsupported"},
"create-calendar.set-displayname": {"support": "full"},
"create-calendar.stable-url": {"support": "full"},
## Found 2026-11-20 on the docker image: the calendar home's listing
## names tasks/ with a display name and ['VTODO'], and a PROPFIND of
## tasks/ answers 404. Bedework 3.10 lists no such calendar.
"propfind.listed-members-exist": {"support": "broken", "behaviour": "lists a tasks/ calendar that answers 404"},
## Not RFC properties; Bedework stores the Apple colour but not the order.
"calendar-color": {"support": "full"},
"calendar-order": {"support": "unsupported"},
Expand Down
10 changes: 6 additions & 4 deletions caldav/testing/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,12 @@ def __init__(self, config: dict[str, Any] | None = None) -> None:
port = int(config.get("port") or os.environ.get("STALWART_PORT", "8809"))
config.setdefault("host", host)
config.setdefault("port", port)
# v0.16+: username is a full email address; default matches setup_stalwart.sh
config.setdefault(
"username", os.environ.get("STALWART_USERNAME", f"testuser@{self._domain}")
)
# v0.16+: the login is a full email address. STALWART_USERNAME may
# be a bare local part, as setup_stalwart.sh reads it.
username = os.environ.get("STALWART_USERNAME", "testuser")
if "@" not in username:
username = f"{username}@{self._domain}"
config.setdefault("username", username)
config.setdefault("password", os.environ.get("STALWART_PASSWORD", "testcaldav"))
if "features" not in config:
config["features"] = compatibility_hints.stalwart_1_1.copy()
Expand Down
1 change: 1 addition & 0 deletions changes/+listed-members-exist.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New compatibility feature `propfind.listed-members-exist`: every calendar the calendar home's listing names is there. Bedework 5 lists a `tasks/` calendar that answers 404, which its profile now records as broken, so a client that takes calendars and their properties from the listing alone knows where to check each one first.
1 change: 1 addition & 0 deletions changes/+listing-props.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`get_calendars()` keeps every property the calendar-list PROPFIND answered in each calendar's `props`, not just the display name. That listing has always asked for `supported-calendar-component-set`, `getctag` and `calendar-color`, then thrown them away, so a client wanting a calendar's component set sent one more PROPFIND per calendar: 268 s against 6 s for 469 calendars on a Synology server. `get_supported_components(use_cached=True)` answers from that set without asking the server. A property the server answered 404 is left out, so it is still fetched when asked for. Cached reads (`get_property(..., use_cached=True)`) of `getctag` and `calendar-color` now answer the listing-time value instead of asking.
24 changes: 12 additions & 12 deletions docs/design/FEATURE_COMPLETE_ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ The v3.2 roadmap covers basic scheduling improvements. Additional work for full
- **Related issue:** [#568](https://github.com/python-caldav/caldav/issues/568)

**Tasks:**
- [x] Add `negate="yes"` attribute support in text-match filters — the `cdav.TextMatch(..., negate=True)` element exists and is used internally (`search.py` `vNotCompleted`/`vNotCancelled`); what is missing is exposing it through the public search API
- [ ] Update `CalDAVSearcher` to support `!=` operator
- [x] Add `negate="yes"` attribute support in text-match filters — the `cdav.TextMatch(..., negate=True)` element exists and is used internally (`search.py` `vNotCompleted`/`vNotCancelled`)
- [x] Update `CalDAVSearcher` to support `!=` operator — **done in v3.5.0** (https://github.com/python-caldav/caldav/pull/750): `add_property_filter()` takes `!=` (alias `<>`), `!contains` and `def`
- [ ] Add server compatibility detection
- [ ] Implement client-side fallback filtering for non-supporting servers
- [ ] Unit and functional tests
- [x] Implement client-side fallback filtering for non-supporting servers — **done in v3.5.0**: `search()` filters the negated operators client-side, as no server has been probed for `negate-condition` yet
- [ ] Unit and functional tests — unit tests are in `tests/test_search.py`; no functional test yet

---

Expand Down Expand Up @@ -312,7 +312,7 @@ change notifications. Requested by the proposal authors themselves.
- [x] Proper `If-Match` / `If-None-Match` header usage — `If-Match` is sent when an ETag is cached (and `If-Schedule-Tag-Match` takes precedence when a Schedule-Tag is) on save, and on delete with `delete(if_match=True)` (https://github.com/python-caldav/caldav/issues/740); `save(no_overwrite=True)` sends `If-None-Match: *` (not on servers where `save.if-none-match` is unsupported), and leaves out its UID search where the server refuses a duplicate UID (`save.no-uid-conflict`, and its `.if-none-match` child, full, quirk or ungraceful) - with a GET of the URL in place of the header where `save.if-none-match` is unsupported. `save(no_create=True)` sends `If-Match: *` instead of searching, where `save-load.mutable.if-match-wildcard` is full and no ETag or Schedule-Tag is cached
- [ ] Handle UID vs path name mismatches
- [ ] Race condition mitigation
- [ ] Clear error messages for conflicts
- [x] Clear error messages for conflicts — `UidConflictError` and its subclasses (https://github.com/python-caldav/caldav/issues/756), naming the object holding the UID in `href` where the server tells (https://github.com/python-caldav/caldav/pull/833), and the `DAV:error` precondition kept on every error (https://github.com/python-caldav/caldav/pull/759)

---

Expand Down Expand Up @@ -351,9 +351,9 @@ change notifications. Requested by the proposal authors themselves.
- **Related issue:** [#552](https://github.com/python-caldav/caldav/issues/552)

**Tasks:**
- [ ] Follow 3xx redirects on PROPFIND — still open, and there is a comment in `davclient.py` marking the spot
- [ ] Update internal URLs after redirect
- [ ] Prevent redirect loops
- [x] Follow 3xx redirects on PROPFIND — every method but GET and HEAD is repeated at the `Location` of a 301/302/307/308 on the same scheme, host and port, with its body (`BaseDAVClient._redirect_target()`, https://github.com/python-caldav/caldav/pull/837)
- [ ] Update internal URLs after redirect — done for PUT and MKCOL/MKCALENDAR (`redirected_to`), not for PROPFIND
- [x] Prevent redirect loops — `MAX_REDIRECTS = 5`

---

Expand Down Expand Up @@ -593,7 +593,7 @@ features.
- [ ] Reduce the remaining sync/async code duplication ([#665](https://github.com/python-caldav/caldav/issues/665))
- [ ] Parse all server iCalendar through `vcal.parse_ical()` consistently ([#698](https://github.com/python-caldav/caldav/issues/698))
- [ ] Shrink the ruff ignore list ([#634](https://github.com/python-caldav/caldav/issues/634))
- [ ] `object.id` should always work ([#94](https://github.com/python-caldav/caldav/issues/94))
- [x] `object.id` should always work ([#94](https://github.com/python-caldav/caldav/issues/94)) — closed as a duplicate of the closed #96; what is left is #515 (8.1)
- [ ] Keep the raw string and the icalendar object side by side instead of
either-or, and skip saving unmodified objects. Needs change tracking in
`icalendar`, requested in [icalendar#1922](https://github.com/PyCalendar/icalendar/issues/1922)
Expand All @@ -620,12 +620,12 @@ features.

These open issues are bug reports, support questions or automated noise rather
than roadmap items, and are deliberately left out:
- [ ] [#71](https://github.com/python-caldav/caldav/issues/71) (`add_event` can update as well),
- [x] [#71](https://github.com/python-caldav/caldav/issues/71) (`add_event` can update as well),
- [ ] [#545](https://github.com/python-caldav/caldav/issues/545) (searches return full-day events of adjacent days),
- [ ] [#612](https://github.com/python-caldav/caldav/issues/612) (support question),
- [x] [#612](https://github.com/python-caldav/caldav/issues/612) (support question),
- [ ] [#624](https://github.com/python-caldav/caldav/issues/624) (GMX calendar creation),
- [ ] server-specific breakage reports ...
- [ ] [#680](https://github.com/python-caldav/caldav/issues/680)
- [x] [#680](https://github.com/python-caldav/caldav/issues/680)
- [x] [#681](https://github.com/python-caldav/caldav/issues/681)
- [ ] [#684](https://github.com/python-caldav/caldav/issues/684)
- [x] [#685](https://github.com/python-caldav/caldav/issues/685) (automated link-checker report).
Expand Down
Loading
Loading