use isdigit() instead of excepting ValueError

This commit is contained in:
Nikos Kouremenos 2005-05-15 11:52:35 +00:00
parent 9152f128e7
commit f4d8ff0944
1 changed files with 4 additions and 4 deletions

View File

@ -1085,11 +1085,11 @@ class Account_modification_window:
config['proxypass'] = self.xml.get_widget('proxypass_entry').get_text() config['proxypass'] = self.xml.get_widget('proxypass_entry').get_text()
if config['use_proxy']: if config['use_proxy']:
if config['proxyport'] != '': if config['proxyport'] != '':
try: if not config['proxyport'].isdigit():
config['proxyport'] = int(config['proxyport']) dialogs.Error_dialog(_('Proxy port must be a port number'))
except ValueError:
dialogs.Error_dialog(_('Proxy Port must be a port number'))
return return
config['proxyport'] = int(config['proxyport'])
else: else:
dialogs.Error_dialog(_('You must enter a proxy port to use proxy')) dialogs.Error_dialog(_('You must enter a proxy port to use proxy'))
return return