valid port type before compare to min and max value

This commit is contained in:
Emmanuel Garette 2014-02-17 18:36:29 +01:00
parent e7531e1fda
commit 8d751ecc9b

View 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):