home
·
contact
·
privacy
projects
/
plomtask
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
47108bf
)
Minor HTTP handler refactoring.
author
Christian Heller
<c.heller@plomlompom.de>
Sat, 18 May 2024 03:44:41 +0000
(
05:44
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sat, 18 May 2024 03:44:41 +0000
(
05:44
+0200)
plomtask/http.py
patch
|
blob
|
history
diff --git
a/plomtask/http.py
b/plomtask/http.py
index 88725fcc57b9ada06d2bb85a4744b489a8bf97e7..d5da1d7e4d914a17b2a27a67e80db762e83f8403 100644
(file)
--- a/
plomtask/http.py
+++ b/
plomtask/http.py
@@
-94,11
+94,7
@@
class TaskHandler(BaseHTTPRequestHandler):
"""Handle any GET request."""
try:
self._init_handling()
"""Handle any GET request."""
try:
self._init_handling()
- if self.site in {'calendar', 'day', 'process', 'process_titles',
- 'process_descriptions', 'process_efforts',
- 'processes', 'todo', 'condition',
- 'condition_titles', 'condition_descriptions',
- 'conditions'}:
+ if hasattr(self, f'do_GET_{self.site}'):
template = f'{self.site}.html'
ctx = getattr(self, f'do_GET_{self.site}')()
html = self.server.jinja.get_template(template).render(**ctx)
template = f'{self.site}.html'
ctx = getattr(self, f'do_GET_{self.site}')()
html = self.server.jinja.get_template(template).render(**ctx)
@@
-211,7
+207,7
@@
class TaskHandler(BaseHTTPRequestHandler):
postvars = parse_qs(self.rfile.read(length).decode(),
keep_blank_values=True, strict_parsing=True)
self.form_data = InputsParser(postvars)
postvars = parse_qs(self.rfile.read(length).decode(),
keep_blank_values=True, strict_parsing=True)
self.form_data = InputsParser(postvars)
- if
self.site in ('day', 'process', 'todo', 'condition
'):
+ if
hasattr(self, f'do_POST_{self.site}
'):
redir_target = getattr(self, f'do_POST_{self.site}')()
self.conn.commit()
else:
redir_target = getattr(self, f'do_POST_{self.site}')()
self.conn.commit()
else: