valid port type before compare to min and max value
authorEmmanuel Garette <egarette@cadoles.com>
Mon, 17 Feb 2014 17:36:29 +0000 (18:36 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Mon, 17 Feb 2014 17:36:29 +0000 (18:36 +0100)
tiramisu/option.py

index af7a67a..d46c8c9 100644 (file)
@@ -852,12 +852,13 @@ class PortOption(Option):
 
         for val in value:
             try:
-                if not self._min_value <= int(val) <= self._max_value:
-                    raise ValueError(_('invalid port, must be an between {0} '
-                                     'and {1}').format(self._min_value,
-                                                       self._max_value))
+                int(val)
             except ValueError:
                 raise ValueError(_('invalid port'))
+            if not self._min_value <= int(val) <= self._max_value:
+                raise ValueError(_('invalid port, must be an between {0} '
+                                    'and {1}').format(self._min_value,
+                                                    self._max_value))
 
 
 class NetworkOption(Option):