Skip to content

Commit

Permalink
fix: Handle KeyError when getting request language
Browse files Browse the repository at this point in the history
This is necessary if we are calling this helper while not actually in a request context.
  • Loading branch information
bellisk committed Dec 2, 2024
1 parent 4767e67 commit 3286b94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ckanext/switzerland/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def index_language_specific_values(search_data, validated_dict):
def get_request_language():
try:
return tk.request.environ["CKAN_LANG"]
except (RuntimeError, TypeError):
except (KeyError, RuntimeError, TypeError):
return tk.config.get("ckan.locale_default", "en")


Expand Down

0 comments on commit 3286b94

Please sign in to comment.