Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #3640 -- Improved error handling in views.i18n.set_language(). …

…Thanks

Jorge Gajon.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4708 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e5fa609ba71583efeb25b7167c7e55708e3d8189 1 parent 2a488f3
@malcolmt malcolmt authored
Showing with 4 additions and 3 deletions.
  1. +1 −0  AUTHORS
  2. +3 −3 django/views/i18n.py
View
1  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
View
6 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:

0 comments on commit e5fa609

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