Auto-append slash to URL when necessary

This should make people happy, if they notice..
This commit is contained in:
Lance Edgar 2016-12-13 22:29:46 -06:00
parent ed252c6465
commit 86c667e1f1

View file

@ -56,6 +56,9 @@ class CommonView(View):
project_title = "Tailbone"
project_version = tailbone.__version__
def notfound(self):
return httpexceptions.HTTPNotFound()
def home(self, mobile=False):
"""
Home page view.
@ -112,6 +115,9 @@ class CommonView(View):
@classmethod
def defaults(cls, config):
# auto-correct URLs which require trailing slash
config.add_notfound_view(cls, attr='notfound', append_slash=True)
# home
config.add_route('home', '/')
config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')