Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,10 @@ def _add_custom_field(self, form_desc, required=True, **kwargs):
# Check to convert options:
field_options = custom_field_dict.get("options")
if field_options:
field_options = [(six.text_type(option.lower()), option) for option in field_options]
try:
field_options = [(six.text_type(value.lower()), name) for value, name in field_options.items()]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I think that we should try first the old format (field_options = [(six.text_type(value.lower()), value) for value in field_options]) and if that fails use the new format. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But how the old format would fail? 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. My bad😂

except AttributeError:
field_options = [(six.text_type(value.lower()), value) for value in field_options]

# Set default option if applies:
default_option = custom_field_dict.get("default")
Expand Down