Created
July 26, 2013 01:15
-
-
Save 1mh0/6085257 to your computer and use it in GitHub Desktop.
Bottle: default page callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @pages_app.get('/:page') | |
| @pages_app.get('/<section:re:(section|another-section)>/:page') | |
| def simple_page(page, section=None): | |
| page_id = request.path.strip('/') | |
| page = Page.get_latest(page_id) | |
| if not page: | |
| return abort(404, "Page not found") | |
| try: | |
| return template('%s.html' % page_id, page=page) | |
| except TemplateError: | |
| return template('pages/default.html', page=page) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment