summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--django/views/i18n.py6
2 files changed, 4 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index 4a027fdd6e..760ffdd21e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -85,6 +85,7 @@ answer newbie questions, and generally made Django that much better:
Marc Fargas <telenieko@telenieko.com>
favo@exoweb.net
Eric Floehr <eric@intellovations.com>
+ Jorge Gajon <gajon@gajon.org>
gandalf@owca.info
Baishampayan Ghose
martin.glueck@gmail.com
diff --git a/django/views/i18n.py b/django/views/i18n.py
index b5eb32bda3..0a19cfe986 100644
--- a/django/views/i18n.py
+++ b/django/views/i18n.py
@@ -9,16 +9,16 @@ def set_language(request):
"""
Redirect to a given url while setting the chosen language in the
session or cookie. The url and the language code need to be
- specified in the GET paramters.
+ specified in the GET parameters.
"""
- lang_code = request.GET['language']
+ lang_code = request.GET.get('language', None)
next = request.GET.get('next', None)
if not next:
next = request.META.get('HTTP_REFERER', None)
if not next:
next = '/'
response = http.HttpResponseRedirect(next)
- if check_for_language(lang_code):
+ if lang_code and check_for_language(lang_code):
if hasattr(request, 'session'):
request.session['django_language'] = lang_code
else: