diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2011-02-12 22:38:23 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2011-02-12 22:38:23 +0000 |
| commit | ee060202409c5700fc2237ce5dab1c0a0486b1d3 (patch) | |
| tree | 4c41f4d4bd6cffe67d9683b7706d6e7fe30544cd | |
| parent | eaf17475b28061f9beed778b9711077379daeae1 (diff) | |
Don't merge in translations twice from deprecated project level tree when it is also listed in LOCALE_PATHS. Thanks Claude Paroz. Refs #14924.
Also, removed some old unused variables as reported by pyflakes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/utils/translation/trans_real.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 66cc305aab..2495cdd0c8 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -67,7 +67,6 @@ class DjangoTranslation(gettext_module.GNUTranslations): Python 2.4. """ def __init__(self, *args, **kw): - from django.conf import settings gettext_module.GNUTranslations.__init__(self, *args, **kw) # Starting with Python 2.4, there's a function to define # the output charset. Before 2.4, the output charset is @@ -136,7 +135,7 @@ def translation(language): t = gettext_module.translation('django', path, [loc], DjangoTranslation) t.set_language(lang) return t - except IOError, e: + except IOError: return None res = _translation(globalpath) @@ -166,7 +165,7 @@ def translation(language): if os.path.isdir(apppath): res = _merge(apppath) - if projectpath and os.path.isdir(projectpath): + if projectpath and os.path.isdir(projectpath) and projectpath not in settings.LOCALE_PATHS: res = _merge(projectpath) for localepath in reversed(settings.LOCALE_PATHS): @@ -365,8 +364,6 @@ def get_language_from_request(request): """ global _accepted from django.conf import settings - globalpath = os.path.join( - os.path.dirname(sys.modules[settings.__module__].__file__), 'locale') supported = dict(settings.LANGUAGES) if hasattr(request, 'session'): |
