From 2f125cfc8c3439136b87c87b944156db82968c5d Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 4 Aug 2020 16:33:52 +0200 Subject: [PATCH] better error for IP like 192.168.001.1 => 192.168.1.1 --- 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 cde3283..0ccdc20 100644 --- a/tiramisu/option/ipoption.py +++ b/tiramisu/option/ipoption.py @@ -62,7 +62,9 @@ class IPOption(StrOption): def _validate_ip(self, value): try: - ip_address(value) + new_value = str(ip_address(value)) + if value != new_value: + raise ValueError(f'should be {new_value}') except ValueError: raise ValueError()