Skip to content

Commit

Permalink
Issue webcompat#3380 - accepts list with 3 and 2 items tuples
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
karlcow committed Jul 14, 2020
1 parent 09853fb commit 304d11a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions webcompat/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 304d11a

Please sign in to comment.