File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -251,6 +251,12 @@ def _input_select_impl(
251251
252252 choices_ = _normalize_choices (choices )
253253
254+ if _contains_html (choices_ ):
255+ warn_deprecated (
256+ "Passing anything other than a string to `choices` parameter of "
257+ "`input_select()` and `input_selectize()` is deprecated."
258+ )
259+
254260 selected = restore_input (resolved_id , selected )
255261 if selected is None and not multiple :
256262 selected = _find_first_option (choices_ )
@@ -332,6 +338,17 @@ def _normalize_choices(x: SelectChoicesArg) -> _SelectChoices:
332338 return x
333339
334340
341+ def _contains_html (x : _SelectChoices ) -> bool :
342+ for v in x .values ():
343+ if isinstance (v , Mapping ):
344+ if _contains_html (cast (_OptGrpChoices , v )):
345+ return True
346+ else :
347+ if not isinstance (v , str ):
348+ return True
349+ return False
350+
351+
335352def _render_choices (
336353 x : _SelectChoices , selected : Optional [str | list [str ]] = None
337354) -> TagList :
You can’t perform that action at this time.
0 commit comments