You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Django 1.7, it became illegal to use ugettext at module import time as the app registry is not ready yet. Django Countries uses ugettext_lazy, so you'd think it would be OK here. However, at line 30 in django_countries/init.py:
if name:
self._countries.append((code, name))
name in this context is a lazy translated string. By testing it for truthiness, it has to be translated. Therefore the module fails to import with "RuntimeError: App registry isn't ready yet"
I'm not sure exactly what use case the condition was put in to support, but either of these changes fixes the issue.
1: removing the condition
self._countries.append((code, name))
2: Using an identity comparison
if name is not None:
self._countries.append((code, name))
Cheers,
Bernie :o)
The text was updated successfully, but these errors were encountered:
Hi,
In Django 1.7, it became illegal to use ugettext at module import time as the app registry is not ready yet. Django Countries uses ugettext_lazy, so you'd think it would be OK here. However, at line 30 in django_countries/init.py:
name
in this context is a lazy translated string. By testing it for truthiness, it has to be translated. Therefore the module fails to import with "RuntimeError: App registry isn't ready yet"I'm not sure exactly what use case the condition was put in to support, but either of these changes fixes the issue.
1: removing the condition
2: Using an identity comparison
Cheers,
Bernie :o)
The text was updated successfully, but these errors were encountered: