Skip to content

Commit

Permalink
fix: catch error if status_list action doesn't exist
Browse files Browse the repository at this point in the history
e.g. if ckanext-status isn't installed
  • Loading branch information
alycejenni committed Jul 4, 2024
1 parent 8cff4f3 commit 38dc575
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ckanext/nhm/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,11 @@ def get_status_indicator():
if status_message:
return 'red'

status_reports = toolkit.get_action('status_list')({}, {})
try:
status_reports = toolkit.get_action('status_list')({}, {})
except KeyError:
# if the action doesn't exist
status_reports = []

# are there any 'bad' items?
red_status = [r for r in status_reports if r['state'] == 'bad']
Expand Down

0 comments on commit 38dc575

Please sign in to comment.