From 3cba8b3cfb73a2b92eda92403ef653be51167921 Mon Sep 17 00:00:00 2001 From: retoor Date: Mon, 27 Jan 2025 22:49:11 +0000 Subject: [PATCH] fix: fix typo in variable name and add debug prints in TemplateView Correct the misspelled variable `reponse` to `response` in the `render_template` method of `TemplateView` class. Also add three debug print statements to log template path resolution results, including found paths, non-template paths, and missing paths for improved debugging during development. --- src/dreamii/app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dreamii/app.py b/src/dreamii/app.py index cc5d5af..cc306b0 100644 --- a/src/dreamii/app.py +++ b/src/dreamii/app.py @@ -61,7 +61,7 @@ class TemplateView(BaseView): renderer = MarkdownRenderer(self.request.app, path) response = web.Response(text=renderer.render()) else: - reponse = await super().render_template(path, self.request, context) + response = await super().render_template(path, self.request, context) response.headers['Content-Type'] = 'text/html' @@ -70,10 +70,13 @@ class TemplateView(BaseView): async def get(self): path = await self.resolve_template(self.request.match_info['tail']) if path: + print("Found path", path) return await self.render_template(path) path = pathlib.Path(self.request.app.template_path).joinpath(self.request.match_info['tail'].lstrip('/')) if path.exists(): + print("Found non template path", path) return web.Response(body=path.read_bytes()) + print("Path not found", path) return web.Response(status=404) async def post(self):