Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored March 12, 2007
1  AUTHORS
@@ -85,6 +85,7 @@ answer newbie questions, and generally made Django that much better:
85 85
     Marc Fargas <telenieko@telenieko.com>
86 86
     favo@exoweb.net
87 87
     Eric Floehr <eric@intellovations.com>
  88
+    Jorge Gajon <gajon@gajon.org>
88 89
     gandalf@owca.info
89 90
     Baishampayan Ghose
90 91
     martin.glueck@gmail.com
6  django/views/i18n.py
@@ -9,16 +9,16 @@ def set_language(request):
9 9
     """
10 10
     Redirect to a given url while setting the chosen language in the
11 11
     session or cookie. The url and the language code need to be
12  
-    specified in the GET paramters.
  12
+    specified in the GET parameters.
13 13
     """
14  
-    lang_code = request.GET['language']
  14
+    lang_code = request.GET.get('language', None)
15 15
     next = request.GET.get('next', None)
16 16
     if not next:
17 17
         next = request.META.get('HTTP_REFERER', None)
18 18
     if not next:
19 19
         next = '/'
20 20
     response = http.HttpResponseRedirect(next)
21  
-    if check_for_language(lang_code):
  21
+    if lang_code and check_for_language(lang_code):
22 22
         if hasattr(request, 'session'):
23 23
             request.session['django_language'] = lang_code
24 24
         else:

0 notes on commit e5fa609

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