From 250201b433c0a99f6cabcb2596bfe43f1a5a3968 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 13 Oct 2023 16:11:25 +0200 Subject: Moving to prod! --- blog_experiment/blog/page.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 blog_experiment/blog/page.py (limited to 'blog_experiment/blog/page.py') diff --git a/blog_experiment/blog/page.py b/blog_experiment/blog/page.py deleted file mode 100644 index fcc4841a..00000000 --- a/blog_experiment/blog/page.py +++ /dev/null @@ -1,37 +0,0 @@ -import bicephalus - - -class BasePage: - def __init__(self, request): - self.request = request - - def response(self): - if self.request.proto == bicephalus.Proto.GEMINI: - status, content_type, content = self.get_gemini_content() - elif self.request.proto == bicephalus.Proto.HTTP: - status, content_type, content = self.get_http_content() - else: - assert False, f"unknown protocol {self.request.proto}" - - return bicephalus.Response( - content=content.encode("utf8"), - content_type=content_type, - status=bicephalus.Status.OK, - ) - - -class NotFound(BasePage): - def get_gemini_content(self): - # TODO: does not work! - return ( - bicephalus.Status.NOT_FOUND, - "text/gemini", - f"{self.request.path} not found", - ) - - def get_http_content(self): - return ( - bicephalus.Status.NOT_FOUND, - "text/html", - f"{self.request.path} not found", - ) -- cgit v1.2.3