Author: mtredinnick
Date: 2008-08-20 20:40:22 -0500 (Wed, 20 Aug 2008)
New Revision: 8457
Modified:
django/trunk/django/contrib/flatpages/middleware.py
django/trunk/django/contrib/flatpages/views.py
Log:
Fixed #8376 -- Use request.path and request.path_info at the right moments when
serving data in the flatpage middleware. Patch from jcassee.
Modified: django/trunk/django/contrib/flatpages/middleware.py
===================================================================
--- django/trunk/django/contrib/flatpages/middleware.py 2008-08-21 01:32:18 UTC
(rev 8456)
+++ django/trunk/django/contrib/flatpages/middleware.py 2008-08-21 01:40:22 UTC
(rev 8457)
@@ -7,7 +7,7 @@
if response.status_code != 404:
return response # No need to check for a flatpage for non-404
responses.
try:
- return flatpage(request, request.path)
+ return flatpage(request, request.path_info)
# Return the original response if any errors happened. Because this
# is a middleware, we can't assume the errors will be caught elsewhere.
except Http404:
Modified: django/trunk/django/contrib/flatpages/views.py
===================================================================
--- django/trunk/django/contrib/flatpages/views.py 2008-08-21 01:32:18 UTC
(rev 8456)
+++ django/trunk/django/contrib/flatpages/views.py 2008-08-21 01:40:22 UTC
(rev 8457)
@@ -20,7 +20,7 @@
`flatpages.flatpages` object
"""
if not url.endswith('/') and settings.APPEND_SLASH:
- return HttpResponseRedirect(url + "/")
+ return HttpResponseRedirect("%s/" % request.path)
if not url.startswith('/'):
url = "/" + url
f = get_object_or_404(FlatPage, url__exact=url,
sites__id__exact=settings.SITE_ID)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---