sync principal
This commit is contained in:
parent
559803ac0e
commit
f6937b5075
3 changed files with 2 additions and 7 deletions
|
@ -48,6 +48,5 @@ _CALDAV_CLIENT = caldav.DAVClient(
|
|||
)
|
||||
|
||||
|
||||
@run_in_executor
|
||||
def caldav_principal() -> caldav.Principal:
|
||||
return _CALDAV_CLIENT.principal()
|
||||
|
|
|
@ -37,11 +37,9 @@ class FileNameLister:
|
|||
@dataclass(frozen=True)
|
||||
class CalendarNameLister:
|
||||
async def __call__(self) -> Iterator[str]:
|
||||
principal = await caldav_principal()
|
||||
|
||||
return (
|
||||
cal.name
|
||||
for cal in principal.calendars()
|
||||
for cal in caldav_principal().calendars()
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from datetime import datetime, timedelta
|
||||
from typing import Iterator
|
||||
|
||||
import caldav
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from .. import caldav_principal
|
||||
|
@ -39,8 +38,7 @@ async def get_calendar(
|
|||
elif len(calendar_names) > 1:
|
||||
raise HTTPException(status_code=status.HTTP_409_CONFLICT)
|
||||
|
||||
principal: caldav.Principal = await caldav_principal()
|
||||
calendar = principal.calendar(name=calendar_names[0])
|
||||
calendar = caldav_principal().calendar(name=calendar_names[0])
|
||||
|
||||
events = []
|
||||
|
||||
|
|
Loading…
Reference in a new issue