better message error
This commit is contained in:
parent
302be618ce
commit
477b0a2da1
1 changed files with 3 additions and 1 deletions
|
@ -64,7 +64,7 @@ class IPOption(StrOption):
|
|||
try:
|
||||
new_value = str(ip_address(value))
|
||||
if value != new_value:
|
||||
raise ValueError(f'should be {new_value}')
|
||||
raise ValueError(_(f'should be {new_value}'))
|
||||
except ValueError:
|
||||
raise ValueError()
|
||||
|
||||
|
@ -72,6 +72,8 @@ class IPOption(StrOption):
|
|||
value: str) -> None:
|
||||
super().validate(value)
|
||||
if self.impl_get_extra('_cidr'):
|
||||
if '/' not in value:
|
||||
raise ValueError(_('CIDR address must have a "/"'))
|
||||
self._validate_cidr(value)
|
||||
else:
|
||||
self._validate_ip(value)
|
||||
|
|
Loading…
Reference in a new issue