extend StringValidator instead

This commit is contained in:
Jakob Ketterl 2021-01-24 22:28:48 +01:00
parent d126c3acef
commit 15940d0a2e

View File

@ -79,12 +79,13 @@ class NumberValidator(OrValidator):
super().__init__(IntegerValidator(), FloatValidator()) super().__init__(IntegerValidator(), FloatValidator())
class RegexValidator(Validator): class RegexValidator(StringValidator):
def __init__(self, regex: re.Pattern): def __init__(self, regex: re.Pattern):
self.regex = regex self.regex = regex
super().__init__()
def isValid(self, value): def isValid(self, value):
return isinstance(value, str) and self.regex.match(value) is not None return super().isValid(value) and self.regex.match(value) is not None
validator_types = { validator_types = {