Skip to content

Commit 157b1a3

Browse files
committed
fix #247: Can't use coroutine callback in put_button()
1 parent b24814b commit 157b1a3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pywebio/io_ctrl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,6 @@ def input_event_handle(item_valid_funcs, form_valid_funcs, preprocess_funcs, onc
382382

383383

384384
def output_register_callback(callback, **options):
385-
"""向当前会话注册毁掉函数"""
385+
"""向当前会话注册回调函数"""
386386
task_id = get_current_session().register_callback(callback, **options)
387387
return task_id

pywebio/output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,11 +798,11 @@ def delete():
798798

799799
def click_callback(btn_idx):
800800
if isinstance(onclick, Sequence):
801-
onclick[btn_idx]()
801+
return onclick[btn_idx]()
802802
else:
803803
btn_val = values[btn_idx]
804804
if not btns[btn_idx].get('disabled'):
805-
onclick(btn_val)
805+
return onclick(btn_val)
806806

807807
callback_id = output_register_callback(click_callback, **callback_options)
808808
spec = _get_output_spec('buttons', callback_id=callback_id, buttons=btns, small=small,

0 commit comments

Comments
 (0)