Skip to content

Commit

Permalink
Fixes #14862 -- Broken links when visiting pages ending in /index/
Browse files Browse the repository at this point in the history
  • Loading branch information
justinabrahms committed Feb 2, 2011
1 parent 74eab7e commit 4207cf6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions django_website/docs/views.py
Expand Up @@ -3,6 +3,7 @@
import datetime
import django.views.static
from django.core import urlresolvers
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.utils import simplejson
Expand Down Expand Up @@ -58,6 +59,9 @@ def objects_inventory(request, lang, version):
response['Content-Type'] = "text/plain"
return response

def redirect_index(request, *args, **kwargs):
return HttpResponseRedirect(request.path.rstrip('index/'))

def search(request, lang, version):
docroot = get_doc_root_or_404(lang, version)

Expand Down
4 changes: 4 additions & 0 deletions django_website/urls/docs.py
Expand Up @@ -35,6 +35,10 @@
r'^(?P<lang>[a-z-]+)/(?P<version>[\w.-]+)/_source/(?P<path>.*)$',
views.source,
),
url(
r'^(.*)/index/$',
views.redirect_index,
),
url(
r'^(?P<lang>[a-z-]+)/(?P<version>[\w.-]+)/(?P<url>[\w./-]*)/$',
views.document,
Expand Down

0 comments on commit 4207cf6

Please sign in to comment.