Author: mtredinnick
Date: 2008-08-20 20:32:18 -0500 (Wed, 20 Aug 2008)
New Revision: 8456

Modified:
   django/trunk/django/middleware/common.py
   django/trunk/tests/regressiontests/middleware/tests.py
Log:
Fixed #8381 -- Fixed a problem with appending slashes in the common middleware
when SCRIPT_NAME contains something other than '/'. Patch from jcassee.

Also fixed the middleware tests to work with this patch.


Modified: django/trunk/django/middleware/common.py
===================================================================
--- django/trunk/django/middleware/common.py    2008-08-20 22:38:15 UTC (rev 
8455)
+++ django/trunk/django/middleware/common.py    2008-08-21 01:32:18 UTC (rev 
8456)
@@ -54,7 +54,7 @@
         # trailing slash and there is no pattern for the current path
         if settings.APPEND_SLASH and (not old_url[1].endswith('/')):
             try:
-                urlresolvers.resolve(request.path)
+                urlresolvers.resolve(request.path_info)
             except urlresolvers.Resolver404:
                 new_url[1] = new_url[1] + '/'
                 if settings.DEBUG and request.method == 'POST':
@@ -69,7 +69,7 @@
         if new_url != old_url:
             # Redirect if the target url exists
             try:
-                urlresolvers.resolve(new_url[1])
+                urlresolvers.resolve("%s/" % request.path_info)
             except urlresolvers.Resolver404:
                 pass
             else:

Modified: django/trunk/tests/regressiontests/middleware/tests.py
===================================================================
--- django/trunk/tests/regressiontests/middleware/tests.py      2008-08-20 
22:38:15 UTC (rev 8455)
+++ django/trunk/tests/regressiontests/middleware/tests.py      2008-08-21 
01:32:18 UTC (rev 8456)
@@ -12,7 +12,7 @@
             'SERVER_NAME': 'testserver',
             'SERVER_PORT': 80,
         }
-        request.path = "/middleware/%s" % path
+        request.path = request.path_info = "/middleware/%s" % path
         return request
 
     def test_append_slash_have_slash(self):


--~--~---------~--~----~------------~-------~--~----~
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