Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensured that the javascript_catalog view doesn't leak translations.

  • Loading branch information...
commit 371dbbe6e01f0fd0276998f6d7f78c86b49d2e97 1 parent da85c8c
Florian Apolloner apollo13 authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 django/views/i18n.py
15 django/views/i18n.py
View
@@ -6,7 +6,7 @@
from django.conf import settings
from django.template import Context, Template
from django.utils import importlib
-from django.utils.translation import check_for_language, activate, to_locale, get_language
+from django.utils.translation import check_for_language, to_locale, get_language
from django.utils.encoding import smart_text
from django.utils.formats import get_format_modules, get_format
from django.utils._os import upath
@@ -205,17 +205,18 @@ def javascript_catalog(request, domain='djangojs', packages=None):
go to the djangojs domain. But this might be needed if you
deliver your JavaScript source from Django templates.
"""
- if request.GET:
- if 'language' in request.GET:
- if check_for_language(request.GET['language']):
- activate(request.GET['language'])
+ default_locale = to_locale(settings.LANGUAGE_CODE)
+ locale = to_locale(get_language())
+
+ if request.GET and 'language' in request.GET:
+ if check_for_language(request.GET['language']):
+ locale = to_locale(request.GET['language'])
+
if packages is None:
packages = ['django.conf']
if isinstance(packages, six.string_types):
packages = packages.split('+')
packages = [p for p in packages if p == 'django.conf' or p in settings.INSTALLED_APPS]
- default_locale = to_locale(settings.LANGUAGE_CODE)
- locale = to_locale(get_language())
t = {}
paths = []
en_selected = locale.startswith('en')
Please sign in to comment.
Something went wrong with that request. Please try again.