Author: mtredinnick
Date: 2007-10-20 03:31:05 -0500 (Sat, 20 Oct 2007)
New Revision: 6553
Modified:
django/trunk/django/middleware/common.py
Log:
Fixed #5762 -- Quoted the portions that make up the URL when appending
"www." or adding a trailing slash in common middleware.
Modified: django/trunk/django/middleware/common.py
===================================================================
--- django/trunk/django/middleware/common.py 2007-10-20 08:15:42 UTC (rev
6552)
+++ django/trunk/django/middleware/common.py 2007-10-20 08:31:05 UTC (rev
6553)
@@ -1,8 +1,10 @@
+import md5
+import re
+
from django.conf import settings
from django import http
from django.core.mail import mail_managers
-import md5
-import re
+from django.utils.http import urlquote
class CommonMiddleware(object):
"""
@@ -46,9 +48,9 @@
if new_url != old_url:
# Redirect
if new_url[0]:
- newurl = "%s://%s%s" % (request.is_secure() and 'https' or
'http', new_url[0], new_url[1])
+ newurl = "%s://%s%s" % (request.is_secure() and 'https' or
'http', new_url[0], urlquote(new_url[1]))
else:
- newurl = new_url[1]
+ newurl = urlquote(new_url[1])
if request.GET:
newurl += '?' + request.GET.urlencode()
return http.HttpResponsePermanentRedirect(newurl)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---