Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
9618d68b
Kaydet (Commit)
9618d68b
authored
Haz 21, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #8033 -- Explained app registry error during translation setup
Thanks Tim Graham and Aymeric Augustin for the review.
üst
21c496ea
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
7 deletions
+20
-7
registry.py
django/apps/registry.py
+2
-2
exceptions.py
django/core/exceptions.py
+5
-0
trans_real.py
django/utils/translation/trans_real.py
+9
-1
applications.txt
docs/ref/applications.txt
+3
-3
1.7.txt
docs/releases/1.7.txt
+1
-1
No files found.
django/apps/registry.py
Dosyayı görüntüle @
9618d68b
...
@@ -4,7 +4,7 @@ import sys
...
@@ -4,7 +4,7 @@ import sys
import
threading
import
threading
import
warnings
import
warnings
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.exceptions
import
AppRegistryNotReady
,
ImproperlyConfigured
from
django.utils
import
lru_cache
from
django.utils
import
lru_cache
from
django.utils.deprecation
import
RemovedInDjango19Warning
from
django.utils.deprecation
import
RemovedInDjango19Warning
from
django.utils._os
import
upath
from
django.utils._os
import
upath
...
@@ -116,7 +116,7 @@ class Apps(object):
...
@@ -116,7 +116,7 @@ class Apps(object):
Raises an exception if the registry isn't ready.
Raises an exception if the registry isn't ready.
"""
"""
if
not
self
.
ready
:
if
not
self
.
ready
:
raise
RuntimeError
(
"App registry isn't ready yet."
)
raise
AppRegistryNotReady
(
)
def
get_app_configs
(
self
):
def
get_app_configs
(
self
):
"""
"""
...
...
django/core/exceptions.py
Dosyayı görüntüle @
9618d68b
...
@@ -12,6 +12,11 @@ class DjangoRuntimeWarning(RuntimeWarning):
...
@@ -12,6 +12,11 @@ class DjangoRuntimeWarning(RuntimeWarning):
pass
pass
class
AppRegistryNotReady
(
Exception
):
"""The django.apps registry is not populated yet"""
pass
class
ObjectDoesNotExist
(
Exception
):
class
ObjectDoesNotExist
(
Exception
):
"""The requested object does not exist"""
"""The requested object does not exist"""
silent_variable_failure
=
True
silent_variable_failure
=
True
...
...
django/utils/translation/trans_real.py
Dosyayı görüntüle @
9618d68b
...
@@ -11,6 +11,7 @@ import warnings
...
@@ -11,6 +11,7 @@ import warnings
from
django.apps
import
apps
from
django.apps
import
apps
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.exceptions
import
AppRegistryNotReady
from
django.dispatch
import
receiver
from
django.dispatch
import
receiver
from
django.test.signals
import
setting_changed
from
django.test.signals
import
setting_changed
from
django.utils.deprecation
import
RemovedInDjango19Warning
from
django.utils.deprecation
import
RemovedInDjango19Warning
...
@@ -160,7 +161,14 @@ class DjangoTranslation(gettext_module.GNUTranslations):
...
@@ -160,7 +161,14 @@ class DjangoTranslation(gettext_module.GNUTranslations):
def
_add_installed_apps_translations
(
self
):
def
_add_installed_apps_translations
(
self
):
"""Merges translations from each installed app."""
"""Merges translations from each installed app."""
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
:
localedir
=
os
.
path
.
join
(
app_config
.
path
,
'locale'
)
localedir
=
os
.
path
.
join
(
app_config
.
path
,
'locale'
)
translation
=
self
.
_new_gnu_trans
(
localedir
)
translation
=
self
.
_new_gnu_trans
(
localedir
)
self
.
merge
(
translation
)
self
.
merge
(
translation
)
...
...
docs/ref/applications.txt
Dosyayı görüntüle @
9618d68b
...
@@ -382,9 +382,9 @@ Troubleshooting
...
@@ -382,9 +382,9 @@ Troubleshooting
Here are some common problems that you may encounter during initialization:
Here are some common problems that you may encounter during initialization:
* ``
RuntimeError: App registry isn't ready yet.`` This happens when importing
* ``
AppRegistryNotReady`` This happens when importing an application
an application configuration or a models module triggers code that depends
configuration or a models module triggers code that depends on the app
on the app
registry.
registry.
For example, :func:`~django.utils.translation.ugettext()` uses the app
For example, :func:`~django.utils.translation.ugettext()` uses the app
registry to look up translation catalogs in applications. To translate at
registry to look up translation catalogs in applications. To translate at
...
...
docs/releases/1.7.txt
Dosyayı görüntüle @
9618d68b
...
@@ -934,7 +934,7 @@ script with::
...
@@ -934,7 +934,7 @@ script with::
>>> import django
>>> import django
>>> django.setup()
>>> django.setup()
Otherwise, you will hit
``RuntimeError: App registry isn't ready yet.``
Otherwise, you will hit
an ``AppRegistryNotReady`` exception.
App registry consistency
App registry consistency
^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment