Correcly handle old versions of the docs, where the file extension is .htm

This commit is contained in:
Magnus Hagander
2011-07-12 14:16:46 +01:00
parent bd8ac3b599
commit 9ffd26ca5d
2 changed files with 8 additions and 3 deletions

View File

@ -23,10 +23,15 @@ def docpage(request, version, typ, filename):
else:
ver = Decimal(version)
page = get_object_or_404(DocPage, version=ver, file="%s.html" % filename)
if ver < Decimal("7.1"):
extension = "htm"
else:
extension = "html"
page = get_object_or_404(DocPage, version=ver, file="%s.%s" % (filename, extension))
if typ=="interactive":
comments = DocComment.objects.filter(version=ver, file="%s.html" % filename, approved=True).order_by('posted_at')
comments = DocComment.objects.filter(version=ver, file="%s.%s" % (filename, extension), approved=True).order_by('posted_at')
else:
comments = None

View File

@ -42,7 +42,7 @@ urlpatterns = patterns('',
(r'^mirrors.xml$', 'downloads.views.mirrors_xml'),
(r'^applications-v2.xml$', 'downloads.views.applications_v2_xml'),
(r'^docs/(current|\d\.\d)/(static|interactive)/(.*).html$', 'docs.views.docpage'),
(r'^docs/(current|\d\.\d)/(static|interactive)/(.*).html?$', 'docs.views.docpage'),
(r'^docs/(current|\d\.\d)/(static|interactive)/$', 'docs.views.docsrootpage'),
(r'^docs/(current|\d\.\d)/$', 'docs.views.redirect_root'),