Content type.
This commit is contained in:
parent
be8519d8b7
commit
66147497a8
@ -61,7 +61,7 @@ class TemplateView(BaseView):
|
|||||||
renderer = MarkdownRenderer(self.request.app, path)
|
renderer = MarkdownRenderer(self.request.app, path)
|
||||||
response = web.Response(text=renderer.render())
|
response = web.Response(text=renderer.render())
|
||||||
else:
|
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'
|
response.headers['Content-Type'] = 'text/html'
|
||||||
|
|
||||||
@ -70,10 +70,13 @@ class TemplateView(BaseView):
|
|||||||
async def get(self):
|
async def get(self):
|
||||||
path = await self.resolve_template(self.request.match_info['tail'])
|
path = await self.resolve_template(self.request.match_info['tail'])
|
||||||
if path:
|
if path:
|
||||||
|
print("Found path", path)
|
||||||
return await self.render_template(path)
|
return await self.render_template(path)
|
||||||
path = pathlib.Path(self.request.app.template_path).joinpath(self.request.match_info['tail'].lstrip('/'))
|
path = pathlib.Path(self.request.app.template_path).joinpath(self.request.match_info['tail'].lstrip('/'))
|
||||||
if path.exists():
|
if path.exists():
|
||||||
|
print("Found non template path", path)
|
||||||
return web.Response(body=path.read_bytes())
|
return web.Response(body=path.read_bytes())
|
||||||
|
print("Path not found", path)
|
||||||
return web.Response(status=404)
|
return web.Response(status=404)
|
||||||
|
|
||||||
async def post(self):
|
async def post(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user