Upgrade caldav to 1.0.1 (#85536)

Upgrade caldav (fix #40127)

date_search was deprecated in favour of search which also implements client-side recurring events expansion
pull/83265/head^2
Daniele Ricci 2023-01-23 01:00:19 +01:00 committed by GitHub
parent 66c3115b26
commit 70a9c8f8aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 8 deletions

View File

@ -2,6 +2,7 @@
from __future__ import annotations
from datetime import date, datetime, timedelta
from functools import partial
import logging
import re
@ -172,7 +173,13 @@ class WebDavCalendarData:
"""Get all events in a specific time frame."""
# Get event list from the current calendar
vevent_list = await hass.async_add_executor_job(
self.calendar.date_search, start_date, end_date
partial(
self.calendar.search,
start=start_date,
end=end_date,
event=True,
expand=True,
)
)
event_list = []
for event in vevent_list:
@ -202,7 +209,12 @@ class WebDavCalendarData:
# We have to retrieve the results for the whole day as the server
# won't return events that have already started
results = self.calendar.date_search(start_of_today, start_of_tomorrow)
results = self.calendar.search(
start=start_of_today,
end=start_of_tomorrow,
event=True,
expand=True,
)
# Create new events for each recurrence of an event that happens today.
# For recurring events, some servers return the original event with recurrence rules

View File

@ -2,7 +2,7 @@
"domain": "caldav",
"name": "CalDAV",
"documentation": "https://www.home-assistant.io/integrations/caldav",
"requirements": ["caldav==0.9.1"],
"requirements": ["caldav==1.0.1"],
"codeowners": [],
"iot_class": "cloud_polling",
"loggers": ["caldav", "vobject"]

View File

@ -507,7 +507,7 @@ btsmarthub_devicelist==0.2.3
buienradar==1.0.5
# homeassistant.components.caldav
caldav==0.9.1
caldav==1.0.1
# homeassistant.components.circuit
circuit-webhook==1.0.1

View File

@ -408,7 +408,7 @@ bthome-ble==2.5.0
buienradar==1.0.5
# homeassistant.components.caldav
caldav==0.9.1
caldav==1.0.1
# homeassistant.components.co2signal
co2signal==0.4.2

View File

@ -349,12 +349,12 @@ def _mocked_dav_client(*names, calendars=None):
def _mock_calendar(name):
calendar = Mock()
events = []
for idx, event in enumerate(EVENTS):
events.append(Event(None, "%d.ics" % idx, event, None, str(idx)))
events.append(Event(None, "%d.ics" % idx, event, calendar, str(idx)))
calendar = Mock()
calendar.date_search = MagicMock(return_value=events)
calendar.search = MagicMock(return_value=events)
calendar.name = name
return calendar