From 02ac1fa53bd0f4114c3a46047db71009e7f3aea2 Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Sun, 4 Feb 2024 05:17:51 -0500 Subject: [PATCH] make sure db connection for request is open --- relay/misc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/relay/misc.py b/relay/misc.py index 94a7182..2a72f22 100644 --- a/relay/misc.py +++ b/relay/misc.py @@ -235,9 +235,6 @@ class Response(AiohttpResponse): class View(AbstractView): - conn: Connection - - def __await__(self) -> Generator[Response]: if (self.request.method) not in METHODS: raise HTTPMethodNotAllowed(self.request.method, self.allowed_methods) @@ -250,7 +247,10 @@ class View(AbstractView): async def _run_handler(self, handler: Awaitable) -> Response: with self.database.config.connection_class(self.database) as conn: - return await handler(self.request,conn, **self.request.match_info) + # todo: remove on next tinysql release + conn.open() + + return await handler(self.request, conn, **self.request.match_info) @cached_property