Author: mtredinnick
Date: 2007-03-12 04:21:22 -0500 (Mon, 12 Mar 2007)
New Revision: 4708

Modified:
   django/trunk/AUTHORS
   django/trunk/django/views/i18n.py
Log:
Fixed #3640 -- Improved error handling in views.i18n.set_language(). Thanks
Jorge Gajon.


Modified: django/trunk/AUTHORS
===================================================================
--- django/trunk/AUTHORS        2007-03-12 09:02:18 UTC (rev 4707)
+++ django/trunk/AUTHORS        2007-03-12 09:21:22 UTC (rev 4708)
@@ -85,6 +85,7 @@
     Marc Fargas <[EMAIL PROTECTED]>
     [EMAIL PROTECTED]
     Eric Floehr <[EMAIL PROTECTED]>
+    Jorge Gajon <[EMAIL PROTECTED]>
     [EMAIL PROTECTED]
     Baishampayan Ghose
     [EMAIL PROTECTED]

Modified: django/trunk/django/views/i18n.py
===================================================================
--- django/trunk/django/views/i18n.py   2007-03-12 09:02:18 UTC (rev 4707)
+++ django/trunk/django/views/i18n.py   2007-03-12 09:21:22 UTC (rev 4708)
@@ -9,16 +9,16 @@
     """
     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:


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to