refac: deprecation fix
This commit is contained in:
parent
9551ee7729
commit
0a5f84eee5
2 changed files with 12 additions and 31 deletions
|
@ -3,8 +3,7 @@ from datetime import datetime, timedelta
|
|||
|
||||
from asyncify import asyncify
|
||||
from cache import AsyncTTL
|
||||
from caldav import Calendar, DAVClient, Principal
|
||||
from caldav.lib.error import ReportError
|
||||
from caldav import Calendar, DAVClient, Event, Principal
|
||||
from vobject.base import Component
|
||||
|
||||
from .calevent import CalEvent
|
||||
|
@ -28,7 +27,6 @@ class CalDAV:
|
|||
Gets the `Principal` object of the main CalDAV client.
|
||||
"""
|
||||
|
||||
_logger.debug("principal")
|
||||
return cls._caldav_client.principal()
|
||||
|
||||
@classmethod
|
||||
|
@ -83,21 +81,12 @@ class CalDAV:
|
|||
dt_start = datetime.combine(date_start, time_min)
|
||||
dt_end = dt_start + search_span
|
||||
|
||||
try:
|
||||
search_result = calendar.date_search(
|
||||
search_result = calendar.search(
|
||||
start=dt_start,
|
||||
end=dt_end,
|
||||
expand=True,
|
||||
verify_expand=True,
|
||||
)
|
||||
|
||||
except ReportError:
|
||||
_logger.warning("CalDAV server does not support expanded search")
|
||||
|
||||
search_result = calendar.date_search(
|
||||
start=dt_start,
|
||||
end=dt_end,
|
||||
expand=False,
|
||||
comp_class=Event,
|
||||
split_expanded=False,
|
||||
)
|
||||
|
||||
vevents = []
|
||||
|
|
|
@ -7,9 +7,7 @@ from fastapi import Depends, HTTPException, params, status
|
|||
_logger = logging.getLogger(__name__)
|
||||
|
||||
_RESPONSE_OK = {
|
||||
status.HTTP_200_OK: {
|
||||
"description": "Operation successful",
|
||||
},
|
||||
status.HTTP_200_OK: {"description": "Operation successful"},
|
||||
}
|
||||
|
||||
Params = ParamSpec("Params")
|
||||
|
@ -39,7 +37,7 @@ class ListManager:
|
|||
if isinstance(names, params.Depends):
|
||||
names = await lister.func()
|
||||
|
||||
_logger.debug("filter %s from %s", repr(prefix), repr(names))
|
||||
# _logger.debug("filter %s from %s", repr(prefix), repr(names))
|
||||
|
||||
return [item for item in names if item.lower().startswith(prefix.lower())]
|
||||
|
||||
|
@ -69,14 +67,8 @@ class ListManager:
|
|||
func=_getter_fn,
|
||||
responses={
|
||||
**_RESPONSE_OK,
|
||||
status.HTTP_404_NOT_FOUND: {
|
||||
"description": "Prefix not found",
|
||||
"content": None,
|
||||
},
|
||||
status.HTTP_409_CONFLICT: {
|
||||
"description": "Ambiguous prefix",
|
||||
"content": None,
|
||||
},
|
||||
status.HTTP_404_NOT_FOUND: {"description": "Prefix not found"},
|
||||
status.HTTP_409_CONFLICT: {"description": "Ambiguous prefix"},
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue