Преглед изворни кода

fix `buttons` parameter check

wangweimin пре 5 година
родитељ
комит
a58318eb59
2 измењених фајлова са 2 додато и 2 уклоњено
  1. 1 1
      pywebio/input.py
  2. 1 1
      pywebio/output.py

+ 1 - 1
pywebio/input.py

@@ -210,7 +210,7 @@ def _parse_action_buttons(buttons):
     for act in buttons:
         if isinstance(act, Mapping):
             assert 'value' in act and 'label' in act, 'actions item must have value and label key'
-        elif isinstance(act, list):
+        elif isinstance(act, (list, tuple)):
             assert len(act) in (2, 3), 'actions item format error'
             act = dict(zip(('label', 'value', 'disabled'), act))
         else:

+ 1 - 1
pywebio/output.py

@@ -241,7 +241,7 @@ def _format_button(buttons):
     for btn in buttons:
         if isinstance(btn, Mapping):
             assert 'value' in btn and 'label' in btn, 'actions item must have value and label key'
-        elif isinstance(btn, list):
+        elif isinstance(btn, (list, tuple)):
             assert len(btn) == 2, 'actions item format error'
             btn = dict(zip(('label', 'value'), btn))
         else: