Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit ee060202409c5700fc2237ce5dab1c0a0486b1d3 1 parent eaf1747
Ramiro Morales authored February 12, 2011

Showing 1 changed file with 2 additions and 5 deletions. Show diff stats Hide diff stats

  1. 7  django/utils/translation/trans_real.py
7  django/utils/translation/trans_real.py
@@ -67,7 +67,6 @@ class DjangoTranslation(gettext_module.GNUTranslations):
67 67
     Python 2.4.
68 68
     """
69 69
     def __init__(self, *args, **kw):
70  
-        from django.conf import settings
71 70
         gettext_module.GNUTranslations.__init__(self, *args, **kw)
72 71
         # Starting with Python 2.4, there's a function to define
73 72
         # the output charset. Before 2.4, the output charset is
@@ -136,7 +135,7 @@ def _translation(path):
136 135
                 t = gettext_module.translation('django', path, [loc], DjangoTranslation)
137 136
                 t.set_language(lang)
138 137
                 return t
139  
-            except IOError, e:
  138
+            except IOError:
140 139
                 return None
141 140
 
142 141
         res = _translation(globalpath)
@@ -166,7 +165,7 @@ def _merge(path):
166 165
             if os.path.isdir(apppath):
167 166
                 res = _merge(apppath)
168 167
 
169  
-        if projectpath and os.path.isdir(projectpath):
  168
+        if projectpath and os.path.isdir(projectpath) and projectpath not in settings.LOCALE_PATHS:
170 169
             res = _merge(projectpath)
171 170
 
172 171
         for localepath in reversed(settings.LOCALE_PATHS):
@@ -365,8 +364,6 @@ def get_language_from_request(request):
365 364
     """
366 365
     global _accepted
367 366
     from django.conf import settings
368  
-    globalpath = os.path.join(
369  
-        os.path.dirname(sys.modules[settings.__module__].__file__), 'locale')
370 367
     supported = dict(settings.LANGUAGES)
371 368
 
372 369
     if hasattr(request, 'session'):

0 notes on commit ee06020

Please sign in to comment.
Something went wrong with that request. Please try again.