From 477b0a2da10f44e63092ce9904e85f9a522729dc Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 24 Jan 2023 22:37:05 +0100 Subject: [PATCH] better message error --- tiramisu/option/ipoption.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tiramisu/option/ipoption.py b/tiramisu/option/ipoption.py index 1c4278e..85ee85e 100644 --- a/tiramisu/option/ipoption.py +++ b/tiramisu/option/ipoption.py @@ -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)