|
75 | 75 | import os.path |
76 | 76 | import logging |
77 | 77 | from collections.abc import Mapping |
| 78 | +import copy |
78 | 79 |
|
79 | 80 | from .io_ctrl import single_input, input_control, output_register_callback, send_msg, single_input_kwargs |
80 | 81 | from .session import get_current_session, get_current_task_id |
@@ -299,14 +300,14 @@ def _parse_select_options(options): |
299 | 300 | # value (label same as value) |
300 | 301 | opts_res = [] |
301 | 302 | for opt in options: |
| 303 | + opt = copy.deepcopy(opt) |
302 | 304 | if isinstance(opt, Mapping): |
303 | 305 | assert 'value' in opt and 'label' in opt, 'options item must have value and label key' |
304 | 306 | elif isinstance(opt, (list, tuple)): |
305 | 307 | assert len(opt) > 1 and len(opt) <= 4, 'options item format error' |
306 | 308 | opt = dict(zip(('label', 'value', 'selected', 'disabled'), opt)) |
307 | 309 | else: |
308 | 310 | opt = dict(value=opt, label=opt) |
309 | | - opt['value'] = opt['value'] |
310 | 311 | opts_res.append(opt) |
311 | 312 |
|
312 | 313 | return opts_res |
@@ -430,6 +431,7 @@ def _parse_action_buttons(buttons): |
430 | 431 | """ |
431 | 432 | act_res = [] |
432 | 433 | for act in buttons: |
| 434 | + act = copy.deepcopy(act) |
433 | 435 | if isinstance(act, Mapping): |
434 | 436 | assert 'label' in act, 'actions item must have label key' |
435 | 437 | assert 'value' in act or act.get('type', 'submit') != 'submit' or act.get('disabled'), \ |
|
0 commit comments