File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 207
207
208
208
209
209
"""
210
+ import copy
210
211
import html
211
212
import io
212
213
import logging
@@ -670,6 +671,7 @@ def _format_button(buttons):
670
671
671
672
btns = []
672
673
for btn in buttons :
674
+ btn = copy .deepcopy (btn )
673
675
if isinstance (btn , Mapping ):
674
676
assert 'value' in btn and 'label' in btn , 'actions item must have value and label key'
675
677
elif isinstance (btn , (list , tuple )):
@@ -763,10 +765,11 @@ def delete():
763
765
764
766
if isinstance (onclick , Sequence ):
765
767
assert len (btns ) == len (onclick ), "`onclick` and `buttons` must be same length."
766
- onclick = {btn ['value' ]: callback for btn , callback in zip (btns , onclick )}
768
+ for idx , btn in enumerate (btns ):
769
+ btn ['value' ] = idx
767
770
768
771
def click_callback (btn_val ):
769
- if isinstance (onclick , dict ):
772
+ if isinstance (onclick , Sequence ):
770
773
return onclick [btn_val ]()
771
774
else :
772
775
return onclick (btn_val )
You can’t perform that action at this time.
0 commit comments