From 541764d87bdefa52626afdb1f3c488b3c8dd89ad Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 11 Jul 2016 15:04:50 -0400 Subject: [PATCH] Fix `get_priority_for_index` method for non-int values Fixes #1607 --- util/secscan/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/util/secscan/__init__.py b/util/secscan/__init__.py index 92a41da08..738b1f57a 100644 --- a/util/secscan/__init__.py +++ b/util/secscan/__init__.py @@ -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' \ No newline at end of file + for priority in PRIORITY_LEVELS: + if PRIORITY_LEVELS[priority]['index'] == int_index: + return priority + + return 'Unknown'