From eea64af900512aaa83146a02f6e7c6d0092b5b3a Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 6 Jun 2024 08:20:22 +0200
Subject: [PATCH] Add minimalist plain-text calendar view.

---
 .pylintrc               |  2 +-
 plomtask/http.py        | 10 +++++++++-
 templates/calendar.html |  2 ++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/.pylintrc b/.pylintrc
index 82e4d96..b4814d1 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,3 +1,3 @@
 [BASIC]
 init-hook='import sys; sys.path.append(".")'
-good-names-rgxs=(test_)?do_(GET|POST)(_[a-z]+)?,test_[A-Z]+
+good-names-rgxs=.*_?do_(GET|POST)(_[a-z]+)?,test_[A-Z]+
diff --git a/plomtask/http.py b/plomtask/http.py
index 1a06f30..bb05fa9 100644
--- a/plomtask/http.py
+++ b/plomtask/http.py
@@ -110,7 +110,7 @@ class TaskHandler(BaseHTTPRequestHandler):
         finally:
             self.conn.close()
 
-    def do_GET_calendar(self) -> dict[str, object]:
+    def _do_GET_calendar(self) -> dict[str, object]:
         """Show Days from ?start= to ?end=."""
         start = self.params.get_str('start')
         end = self.params.get_str('end')
@@ -124,6 +124,14 @@ class TaskHandler(BaseHTTPRequestHandler):
         today = date_in_n_days(0)
         return {'start': start, 'end': end, 'days': days, 'today': today}
 
+    def do_GET_calendar(self) -> dict[str, object]:
+        """Show Days from ?start= to ?end= – normal view."""
+        return self._do_GET_calendar()
+
+    def do_GET_calendar_txt(self) -> dict[str, object]:
+        """Show Days from ?start= to ?end= – minimalist view."""
+        return self._do_GET_calendar()
+
     def do_GET_day(self) -> dict[str, object]:
         """Show single Day of ?date=."""
         date = self.params.get_str('date', date_in_n_days(0))
diff --git a/templates/calendar.html b/templates/calendar.html
index 42c821a..699caab 100644
--- a/templates/calendar.html
+++ b/templates/calendar.html
@@ -35,6 +35,8 @@ td.today {
 {% block content %}
 <h3>calendar</h3>
 
+<p><a href="/calendar_txt">basic view</a></p>
+
 <form action="calendar" method="GET">
 from <input name="start" value="{{start}}" />
 to <input name="end" value="{{end}}" />
-- 
2.30.2