Fix get_priority_for_index method for non-int values

Fixes #1607
This commit is contained in:
Joseph Schorr 2016-07-11 15:04:50 -04:00
parent 3044f8ecbd
commit 541764d87b

View file

@ -97,8 +97,13 @@ PRIORITY_LEVELS = {
def get_priority_for_index(index):
for priority in PRIORITY_LEVELS:
if PRIORITY_LEVELS[priority]['index'] == index:
return priority
try:
int_index = int(index)
except ValueError:
return 'Unknown'
return 'Unknown'
for priority in PRIORITY_LEVELS:
if PRIORITY_LEVELS[priority]['index'] == int_index:
return priority
return 'Unknown'