From: Christian Heller Date: Sat, 20 Jul 2024 22:02:46 +0000 (+0200) Subject: In POST /todo, catch more illegal 'step_filler' values. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bdb.prefix%7D%7D/calendar?a=commitdiff_plain;h=bc77b1cd146b109d2d17df55961e8a72d2a6cd17;p=plomtask In POST /todo, catch more illegal 'step_filler' values. --- diff --git a/plomtask/http.py b/plomtask/http.py index cb131e2..bcd6d1c 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -644,7 +644,7 @@ class TaskHandler(BaseHTTPRequestHandler): is_done = len(self._form_data.get_all_str('done')) > 0 calendarize = len(self._form_data.get_all_str('calendarize')) > 0 comment = self._form_data.get_str('comment', ignore_strict=True) - for filler in step_fillers: + for filler in [f for f in step_fillers if f != 'ignore']: target_id: int to_int = filler for prefix in [p for p in ['make_empty_', 'make_full_'] @@ -659,7 +659,7 @@ class TaskHandler(BaseHTTPRequestHandler): processes_to_make_empty += [target_id] elif filler.startswith('make_full_'): processes_to_make_full += [target_id] - elif filler != 'ignore': + else: adopted_child_ids += [target_id] to_remove = [] for child in todo.children: diff --git a/tests/todos.py b/tests/todos.py index 89d9a8c..695d9a7 100644 --- a/tests/todos.py +++ b/tests/todos.py @@ -421,6 +421,11 @@ class TestsWithServer(TestCaseWithServer): step_proc3 = self._step_as_dict(2, [], 3, 5, True) expected['steps_todo_to_process'] = [step_proc2, step_proc3] self.check_json_get('/todo?id=1', expected) + # test 'ignore' values for 'step_filler' are ignored, and intable + # 'step_filler' values are interchangeable with those of 'adopt' + todo_post = {'adopt': 5, 'step_filler': ['ignore', 4]} + self.check_post(todo_post, '/todo?id=1') + self.check_json_get('/todo?id=1', expected) # test cannot adopt into non-top-level elements of chain self.post_process(4, proc_post) self.post_process(3, proc_post | {'new_top_step': 4, 'step_of': [1]})