Catch ValueError in to_int (closes #125)

This commit is contained in:
sigma67 2020-12-18 12:43:44 +01:00
commit 0ab4d41e9d
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0

View file

@ -67,8 +67,13 @@ def get_authorization(auth):
def to_int(string):
number = string.split(' ')[0]
return locale.atoi(number)
number_string = string.split(' ')[0]
try:
int_value = locale.atoi(number_string)
except ValueError:
number_string = number_string.replace(',', '')
int_value = int(number_string)
return int_value
def i18n(method):