From: Christian Heller Date: Wed, 27 Mar 2024 03:54:34 +0000 (+0100) Subject: Minor code documentation changes. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/blog?a=commitdiff_plain;h=87398980c438de55ff17098790a59e123624493b;p=plomtask Minor code documentation changes. --- diff --git a/plomtask/http.py b/plomtask/http.py index 86db94d..3dde6e2 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -24,7 +24,7 @@ class TaskServer(HTTPServer): self.jinja = JinjaEnv(loader=JinjaFSLoader(TEMPLATES_DIR)) -class ParamsParser: # pylint: disable=too-few-public-methods +class ParamsParser: """Wrapper for validating and retrieving GET params.""" def __init__(self, params: dict[str, list[str]]) -> None: @@ -37,7 +37,7 @@ class ParamsParser: # pylint: disable=too-few-public-methods return self.params[key][0] def get_int_or_none(self, key: str) -> int | None: - """Retrieve int value of key yfrom self.params, on fail return None.""" + """Retrieve int value of key from self.params, on empty return None.""" if key not in self.params or not self.params[key]: return None val = self.params[key][0] @@ -144,7 +144,7 @@ class TaskHandler(BaseHTTPRequestHandler): def do_POST_process(self, conn: DatabaseConnection, params: ParamsParser, form_data: PostvarsParser) -> None: - """Update or insert Process of id_ and fields defined in postvars.""" + """Update or insert Process of ?id= and fields defined in postvars.""" id_ = params.get_int_or_none('id') process = Process.by_id(conn, id_, create=True) process.title.set(form_data.get_str('title'))