aboutsummaryrefslogtreecommitdiff
path: root/blog_experiment/blog/page.py
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2023-10-13 16:11:25 +0200
committeralex <alex@pdp7.net>2023-10-13 16:11:25 +0200
commit250201b433c0a99f6cabcb2596bfe43f1a5a3968 (patch)
tree8dc5de16ed4315b3ab4fcc001b7dbd74d475c4b3 /blog_experiment/blog/page.py
parent1a80ac63854ba4ea28f81194ad15314771e979d5 (diff)
Moving to prod!
Diffstat (limited to 'blog_experiment/blog/page.py')
-rw-r--r--blog_experiment/blog/page.py37
1 files changed, 0 insertions, 37 deletions
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",
- )