Skip to content

Commit f4af2f2

Browse files
committed
pin name allow minus sign
1 parent 0c0c471 commit f4af2f2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pywebio/pin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,17 @@
132132
run_async, register_thread, SessionException
133133
from .utils import run_as_function, to_coroutine
134134

135-
_html_value_chars = set(string.ascii_letters + string.digits + '_')
135+
_pin_name_chars = set(string.ascii_letters + string.digits + '_-')
136136

137137
__all__ = ['put_input', 'put_textarea', 'put_select', 'put_checkbox', 'put_radio', 'put_slider', 'put_actions',
138138
'pin', 'pin_update', 'pin_wait_change', 'pin_on_change']
139139

140140

141141
def check_name(name):
142-
assert all(i in _html_value_chars for i in name), "pin `name` can only contain letters, digits and underscore"
142+
assert all(i in _pin_name_chars for i in name), "pin `name` can only contain letters, digits, " \
143+
"minus sign and underscore"
143144
assert name != 'use_strict', "'use_strict' is a reserve name, can't use as pin widget name"
144-
assert name[0] in string.ascii_letters, "pin `name` can only starts with letters"
145+
assert name != '_strict', "'_strict' is a reserve name, can't use as pin widget name"
145146

146147

147148
def _pin_output(single_input_return, scope, position):

0 commit comments

Comments
 (0)