Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django-countries is broken on 1.7b1, with fix #43

Closed
BernieSumption opened this issue Mar 27, 2014 · 1 comment
Closed

django-countries is broken on 1.7b1, with fix #43

BernieSumption opened this issue Mar 27, 2014 · 1 comment

Comments

@BernieSumption
Copy link

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:

                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)

@SmileyChris
Copy link
Owner

Cheers, released as 2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants