summaryrefslogtreecommitdiff
path: root/kvmd/validators/kvm.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-08 11:35:29 +0300
committerDevaev Maxim <[email protected]>2020-09-08 11:35:29 +0300
commit5ba0873c32be21fdff822dcac47095d944a29cd3 (patch)
tree8c423b5bcbbab9f4722f1b4992246dd8a881375b /kvmd/validators/kvm.py
parentcf5114264b863a7e966a38c0448cf6e5c1214507 (diff)
stronger validators
Diffstat (limited to 'kvmd/validators/kvm.py')
-rw-r--r--kvmd/validators/kvm.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/kvmd/validators/kvm.py b/kvmd/validators/kvm.py
index fe9a8a8e..17895c47 100644
--- a/kvmd/validators/kvm.py
+++ b/kvmd/validators/kvm.py
@@ -28,6 +28,7 @@ from ..keyboard.mappings import KEYMAP
from . import raise_error
from . import check_string_in_list
from . import check_re_match
+from . import check_len
from .basic import valid_stripped_string_not_empty
from .basic import valid_number
@@ -92,7 +93,8 @@ def valid_hid_mouse_wheel(arg: Any) -> int:
# =====
def valid_ugpio_driver(arg: Any) -> str:
- return check_re_match(arg, "GPIO driver", r"^[a-zA-Z_][a-zA-Z0-9_-]*$")[:255]
+ name = "GPIO driver"
+ return check_len(check_re_match(arg, name, r"^[a-zA-Z_][a-zA-Z0-9_-]*$"), name, 255)
def valid_ugpio_mode(arg: Any) -> str:
@@ -100,7 +102,8 @@ def valid_ugpio_mode(arg: Any) -> str:
def valid_ugpio_channel(arg: Any) -> str:
- return check_re_match(arg, "GPIO channel", r"^[a-zA-Z_][a-zA-Z0-9_-]*$")[:255]
+ name = "GPIO channel"
+ return check_len(check_re_match(arg, name, r"^[a-zA-Z_][a-zA-Z0-9_-]*$"), name, 255)
def valid_ugpio_view_table(arg: Any) -> List[List[str]]: