From a25bcfcafaf5a8f3247add59240459ffc61a110c Mon Sep 17 00:00:00 2001 From: vlack Date: Thu, 3 Dec 2020 20:02:11 +0300 Subject: [PATCH] Add schedule by person --- calendar_fu/calendar_creator.py | 2 +- calendar_fu/handlers.py | 2 +- calendar_fu/services.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/calendar_fu/calendar_creator.py b/calendar_fu/calendar_creator.py index 6a66470..f039113 100644 --- a/calendar_fu/calendar_creator.py +++ b/calendar_fu/calendar_creator.py @@ -93,7 +93,7 @@ def create_calendar( return calendar.ical() -async def download_calendar_json(id: int, type: str): +async def download_calendar_json(id: str, type: str): date_start, date_end = get_dates() async with ClientSession() as client: try: diff --git a/calendar_fu/handlers.py b/calendar_fu/handlers.py index f607748..8bbe74f 100644 --- a/calendar_fu/handlers.py +++ b/calendar_fu/handlers.py @@ -39,7 +39,7 @@ def params_handler(query: MultiDict) -> dict: class CalendarView(BaseView): async def get(self): type = self.request.match_info["type"] - id = int(self.request.match_info["id"]) + id = self.request.match_info["id"] params = params_handler(self.request.rel_url.query) filename = f"{type}_{id}" last_update = await self.cache.last_update(filename) diff --git a/calendar_fu/services.py b/calendar_fu/services.py index efcf173..1f412b7 100644 --- a/calendar_fu/services.py +++ b/calendar_fu/services.py @@ -33,7 +33,7 @@ async def create_application(self) -> Application: app.add_routes( [ view( - r"/calendar/{type:(group|lecturer)}/{id:\d+}{f:(.ics)?}", + r"/calendar/{type:(group|lecturer|person)}/{id:[\d\w-]+}{f:(.ics)?}", CalendarView, ), ]