Skip to content

Commit

Permalink
[master,controller/template][xs]: support urls which do not have .htm…
Browse files Browse the repository at this point in the history
…l in them (but template does) and only abort 404 on template not found as otherwise we can hide errors.
  • Loading branch information
rufuspollock committed Mar 20, 2012
1 parent c594ef2 commit 858e230
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ckan/controllers/template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ckan.lib.base import *
from genshi.template.loader import TemplateNotFound

class TemplateController(BaseController):

Expand Down Expand Up @@ -26,5 +27,12 @@ def view(self, url):
"""
try:
return render(url)
except:
abort(404)
except TemplateNotFound:
if url.endswith('.html'):
abort(404)
url += '.html'
try:
return render(url)
except TemplateNotFound:
abort(404)

0 comments on commit 858e230

Please sign in to comment.