domainnameoption: better error message

This commit is contained in:
egarette@silique.fr 2023-04-12 12:02:37 +02:00
parent 8b4ceddb81
commit d2a7c2b31c

View file

@ -74,12 +74,10 @@ class DomainnameOption(StrOption):
else:
min_time = 1
regexp = r'((?!-)[a-z0-9-]{{{1},{0}}}\.){{{1},}}[a-z0-9-]{{1,{0}}}'.format(self._get_len(type), min_time)
msg = _('only lowercase, number, "-" and "." characters are allowed')
msg_warning = _('only lowercase, number, "-" and "." characters are recommanded')
else:
regexp = r'((?!-)[a-z0-9-]{{1,{0}}})'.format(self._get_len(type))
msg = _('only lowercase, number and "-" characters are allowed')
msg_warning = _('only lowercase, number and "-" characters are recommanded')
msg = _('must start with lowercase characters followed by lowercase characters, number, "-" and "." characters are allowed')
msg_warning = _('must start with lowercase characters followed by lowercase characters, number, "-" and "." characters are recommanded')
if allow_ip:
msg = _('could be a IP, otherwise {}').format(msg)
msg_warning = _('could be a IP, otherwise {}').format(msg_warning)