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
1 changed files with 5 additions and 4 deletions

View File

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