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:
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]
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'))