From 304d11a7c23ac845ef192cb3d00671ec81ee888b Mon Sep 17 00:00:00 2001 From: Karl Dubost Date: Tue, 14 Jul 2020 11:32:58 +0900 Subject: [PATCH] Issue #3380 - accepts list with 3 and 2 items tuples Originally the list of tuples were 2 items long. but the wizard is using in some cases 3 items long list (because of icons) for radio fields. This leds to the duplication of the list of problem_choices with 2 items and 3 items. So instead of duplicating code, let's handle it in the function itself. There might be something more elegant to do. We can discover that later. --- webcompat/form.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webcompat/form.py b/webcompat/form.py index f403f2e68..0806b8d0e 100644 --- a/webcompat/form.py +++ b/webcompat/form.py @@ -329,6 +329,8 @@ def build_details(details): def get_radio_button_label(field_value, label_list): """Return human-readable label for problem choices form value.""" + if len(label_list[0]) == 3: + label_list = [(value, text) for value, icon, text in label_list] for value, text in label_list: if value == field_value: return text