Use the non-deprecated vobject_instance in caldav (#179819)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Paulus Schoutsen
2026-08-23 23:16:12 +03:00
committed by GitHub
co-authored by Claude
parent 1ff08153a1
commit 149f0316f2
2 changed files with 9 additions and 9 deletions
@@ -67,10 +67,10 @@ class CalDavUpdateCoordinator(DataUpdateCoordinator[CalendarEvent | None]):
)
event_list = []
for event in vevent_list:
if not hasattr(event.instance, "vevent"):
if not hasattr(event.vobject_instance, "vevent"):
_LOGGER.warning("Skipped event with missing 'vevent' property")
continue
vevent = event.instance.vevent
vevent = event.vobject_instance.vevent
if not self.is_matching(vevent, self.search):
continue
event_list.append(
@@ -122,10 +122,10 @@ class CalDavUpdateCoordinator(DataUpdateCoordinator[CalendarEvent | None]):
# and they would not be properly parsed using their original start/end dates.
new_events = []
for event in results:
if not hasattr(event.instance, "vevent"):
if not hasattr(event.vobject_instance, "vevent"):
_LOGGER.warning("Skipped event with missing 'vevent' property")
continue
vevent = event.instance.vevent
vevent = event.vobject_instance.vevent
for start_dt in vevent.getrruleset() or []:
_start_of_today: date | datetime
_start_of_tomorrow: datetime | date
@@ -138,7 +138,7 @@ class CalDavUpdateCoordinator(DataUpdateCoordinator[CalendarEvent | None]):
_start_of_tomorrow = start_of_tomorrow
if _start_of_today <= start_dt < _start_of_tomorrow:
new_event = event.copy()
new_vevent = new_event.instance.vevent # type: ignore[attr-defined]
new_vevent = new_event.vobject_instance.vevent # type: ignore[attr-defined]
if hasattr(new_vevent, "dtend"):
dur = new_vevent.dtend.value - new_vevent.dtstart.value
new_vevent.dtend.value = start_dt + dur
@@ -147,9 +147,9 @@ class CalDavUpdateCoordinator(DataUpdateCoordinator[CalendarEvent | None]):
elif _start_of_tomorrow <= start_dt:
break
vevents = [
event.instance.vevent
event.vobject_instance.vevent
for event in results + new_events
if hasattr(event.instance, "vevent")
if hasattr(event.vobject_instance, "vevent")
]
# dtstart can be a date or datetime depending if the event lasts a
+2 -2
View File
@@ -73,8 +73,8 @@ def _get_todo_items(calendar: caldav.Calendar) -> list[TodoItem]:
def _todo_item(resource: caldav.CalendarObjectResource) -> TodoItem | None:
"""Convert a caldav Todo into a TodoItem."""
if (
not hasattr(resource.instance, "vtodo")
or not (todo := resource.instance.vtodo)
not hasattr(resource.vobject_instance, "vtodo")
or not (todo := resource.vobject_instance.vtodo)
or (uid := get_attr_value(todo, "uid")) is None
or (summary := get_attr_value(todo, "summary")) is None
):