summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-06-21 15:00:35 +0200
committerClaude Paroz <claude@2xlibre.net>2014-06-23 09:37:38 +0200
commitf50a17785cdb67bc9d1b146d01c731cb6bfc48cf (patch)
treef5b62e1a08eaed1e22893a10ebfe401779c29331 /django/utils
parent29582ad4a3ef5888ef86a45167ed8e7414c1347e (diff)
[1.7.x] Fixed #8033 -- Explained app registry error during translation setup
Thanks Tim Graham and Aymeric Augustin for the review. Backport of 9618d68b34 from master.
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/translation/trans_real.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 0fe5ebd7ae..46f38042c1 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -10,6 +10,7 @@ from threading import local
import warnings
from django.apps import apps
+from django.core.exceptions import AppRegistryNotReady
from django.dispatch import receiver
from django.test.signals import setting_changed
from django.utils.deprecation import RemovedInDjango19Warning
@@ -181,7 +182,14 @@ def translation(language):
res.merge(t)
return res
- for app_config in reversed(list(apps.get_app_configs())):
+ try:
+ app_configs = reversed(list(apps.get_app_configs()))
+ except AppRegistryNotReady:
+ raise AppRegistryNotReady(
+ "The translation infrastructure cannot be initialized before the "
+ "apps registry is ready. Check that you don't make non-lazy "
+ "gettext calls at import time.")
+ for app_config in app_configs:
apppath = os.path.join(app_config.path, 'locale')
if os.path.isdir(apppath):
res = _merge(apppath)