Use specific does-not-exist exception

This commit is contained in:
Roland Geider committed 2023-02-13 11:51:33 +01:00
1 parent 67642d6bd6
commit 17ac0b05f3
1 file changed
+1 -3
+1 -3
View File
@@ -17,7 +17,6 @@ import logging
# Django
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.utils import translation
# wger
@@ -46,8 +45,7 @@ def load_language(language_code=None):
try:
language = Language.objects.get(short_name=used_language)
except ObjectDoesNotExist:
# No luck, load english as our fall-back language
except Language.DoesNotExist:
language = Language.objects.get(short_name=ENGLISH_SHORT_NAME)
cache.set(cache_mapper.get_language_key(language.short_name), language)