mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #6213 -- Updated the flatpages app to only append a slash if the flatpage actually exist.
The FlatpageFallbackMiddleware (and the view) now only add a trailing slash and redirect if the resulting URL refers to an existing flatpage. Previously requesting /notaflatpageoravalidurl would redirect to /notaflatpageoravalidurl/, which would then raise a 404. Requesting /notaflatpageoravalidurl now will immediately raise a 404. Also, Redirects returned by flatpages are now permanent (301 status code) to match the behaviour of the CommonMiddleware. Thanks to Steve Losh for the initial work on the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -77,6 +77,18 @@ does all of the work.
|
||||
:class:`~django.template.RequestContext` in rendering the
|
||||
template.
|
||||
|
||||
.. versionchanged:: 1.4
|
||||
The middleware will only add a trailing slash and redirect (by looking
|
||||
at the :setting:`APPEND_SLASH` setting) if the resulting URL refers to
|
||||
a valid flatpage. Previously requesting a non-existent flatpage
|
||||
would redirect to the same URL with an apppended slash first and
|
||||
subsequently raise a 404.
|
||||
|
||||
.. versionchanged:: 1.4
|
||||
Redirects by the middlware are permanent (301 status code) instead of
|
||||
temporary (302) to match behaviour of the
|
||||
:class:`~django.middleware.common.CommonMiddleware`.
|
||||
|
||||
If it doesn't find a match, the request continues to be processed as usual.
|
||||
|
||||
The middleware only gets activated for 404s -- not for 500s or responses
|
||||
|
||||
Reference in New Issue
Block a user