mirror of
https://github.com/wger-project/wger.git
synced 2026-12-06 07:54:11 +01:00
Use specific does-not-exist exception
This commit is contained in:
1 parent
67642d6bd6
commit
17ac0b05f3
1 file changed
+1
-3
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user