home · contact · privacy
Add rump Days module.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 16 Mar 2024 23:00:29 +0000 (00:00 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 16 Mar 2024 23:00:29 +0000 (00:00 +0100)
scripts/pre-commit
task.py
templates/calendar.html [new file with mode: 0644]
templates/index.html [deleted file]

index a053262bcb0c49ea34392c4b11a779e8fe2b4431..e1cfb733180349084416dae48f301d795815ffc2 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 set -e
 #!/bin/sh
 set -e
-python3 -m mypy task.py
-python3 -m flake8 task.py
-python3 -m pylint --good-names 'do_GET,do_POST' task.py
+python3 -m mypy *.py
+python3 -m flake8 *.py
+python3 -m pylint --good-names 'do_GET,do_POST' *.py
 exit 0
 exit 0
diff --git a/task.py b/task.py
index 2a6c699f99cb956192a33727a69cb7f808cd8ff2..d6128eeed5fc20d0d919a91dc3c00fea14ad4150 100755 (executable)
--- a/task.py
+++ b/task.py
@@ -5,6 +5,7 @@ plom's task manager
 from http.server import BaseHTTPRequestHandler
 from http.server import HTTPServer
 from jinja2 import Environment as JinjaEnv, FileSystemLoader as JinjaFSLoader
 from http.server import BaseHTTPRequestHandler
 from http.server import HTTPServer
 from jinja2 import Environment as JinjaEnv, FileSystemLoader as JinjaFSLoader
+from days import Day
 
 HTTP_PORT = 8082
 TEMPLATES_DIR = 'templates'
 
 HTTP_PORT = 8082
 TEMPLATES_DIR = 'templates'
@@ -21,7 +22,10 @@ class TaskHandler(BaseHTTPRequestHandler):
         """Handle any GET request."""
         self.send_response(200)
         self.end_headers()
         """Handle any GET request."""
         self.send_response(200)
         self.end_headers()
-        html = self.server.jinja.get_template('index.html').render()
+        days = [Day('2024-01-03'), Day('2024-01-01'), Day('2024-01-02')]
+        days.sort()
+        html = self.server.jinja.get_template('calendar.html').render(
+                days=days)
         self.wfile.write(bytes(html, 'utf-8'))
 
 
         self.wfile.write(bytes(html, 'utf-8'))
 
 
diff --git a/templates/calendar.html b/templates/calendar.html
new file mode 100644 (file)
index 0000000..0f18203
--- /dev/null
@@ -0,0 +1,9 @@
+{% extends 'base.html' %}
+
+{% block content %}
+<ul>
+{% for day in days %}
+<li>{{day.date}} ({{day.weekday}})
+{% endfor %}
+</ul>
+{% endblock %}
diff --git a/templates/index.html b/templates/index.html
deleted file mode 100644 (file)
index 72d81d4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-{% extends 'base.html' %}
-
-{% block content %}
-Hi there!
-{% endblock %}