Auto-append slash to URL when necessary
This should make people happy, if they notice..
This commit is contained in:
parent
ed252c6465
commit
86c667e1f1
|
@ -56,6 +56,9 @@ class CommonView(View):
|
||||||
project_title = "Tailbone"
|
project_title = "Tailbone"
|
||||||
project_version = tailbone.__version__
|
project_version = tailbone.__version__
|
||||||
|
|
||||||
|
def notfound(self):
|
||||||
|
return httpexceptions.HTTPNotFound()
|
||||||
|
|
||||||
def home(self, mobile=False):
|
def home(self, mobile=False):
|
||||||
"""
|
"""
|
||||||
Home page view.
|
Home page view.
|
||||||
|
@ -108,10 +111,13 @@ class CommonView(View):
|
||||||
uncaught exception handling.
|
uncaught exception handling.
|
||||||
"""
|
"""
|
||||||
raise Exception("Congratulations, you have triggered a bogus error.")
|
raise Exception("Congratulations, you have triggered a bogus error.")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def defaults(cls, config):
|
def defaults(cls, config):
|
||||||
|
|
||||||
|
# auto-correct URLs which require trailing slash
|
||||||
|
config.add_notfound_view(cls, attr='notfound', append_slash=True)
|
||||||
|
|
||||||
# home
|
# home
|
||||||
config.add_route('home', '/')
|
config.add_route('home', '/')
|
||||||
config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')
|
config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')
|
||||||
|
|
Loading…
Reference in a new issue