X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/balance2?a=blobdiff_plain;f=plomtask%2Fhttp.py;h=33961255889a2e00933e6110422ccb02e5aae88d;hb=11c4e6fc42ab96a13b18e8195c264899e31dddf0;hp=1046eccbb1523c784717ca8d5f7a970d11404b85;hpb=17be4d0a78f3d1b56df588807b6bda05bb2d8ebc;p=plomtask diff --git a/plomtask/http.py b/plomtask/http.py index 1046ecc..3396125 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -53,7 +53,6 @@ class TaskHandler(BaseHTTPRequestHandler): return else: raise NotFoundException(f'Unknown page: /{site}') - conn.commit() conn.close() self._send_html(html) except HandledException as error: @@ -108,6 +107,8 @@ class TaskHandler(BaseHTTPRequestHandler): date: str, postvars: dict[str, list[str]]) -> None: """Update or insert Day of date and fields defined in postvars.""" day = Day.by_date(conn, date, create=True) + if 'comment' not in postvars.keys(): + raise BadFormatException('missing Day.comment value') day.comment = postvars['comment'][0] day.save(conn) @@ -115,6 +116,12 @@ class TaskHandler(BaseHTTPRequestHandler): postvars: dict[str, list[str]]) -> None: """Update or insert Process of id_ and fields defined in postvars.""" process = Process.by_id(conn, id_, create=True) + if 'title' not in postvars.keys(): + raise BadFormatException('missing Process.title value') + if 'description' not in postvars.keys(): + raise BadFormatException('missing Process.description value') + if 'effort' not in postvars.keys(): + raise BadFormatException('missing Process.effort value') process.title.set(postvars['title'][0]) process.description.set(postvars['description'][0]) effort = postvars['effort'][0]