source: web/old/sipbmp3web/controllers/template.py @ f6f3e91

web
Last change on this file since f6f3e91 was f6f3e91, checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago

Preserve directory hierarchy (not sure what happened to it)

  • Property mode set to 100644
File size: 857 bytes
Line 
1from sipbmp3web.lib.base import *
2
3class TemplateController(BaseController):
4
5    def view(self, url):
6        """By default, the final controller tried to fulfill the request
7        when no other routes match. It may be used to display a template
8        when all else fails, e.g.::
9
10            def view(self, url):
11                return render('/%s' % url)
12
13        Or if you're using Mako and want to explicitly send a 404 (Not
14        Found) response code when the requested template doesn't exist::
15
16            import mako.exceptions
17
18            def view(self, url):
19                try:
20                    return render('/%s' % url)
21                except mako.exceptions.TopLevelLookupException:
22                    abort(404)
23
24        By default this controller aborts the request with a 404 (Not
25        Found)
26        """
27        abort(404)
Note: See TracBrowser for help on using the repository browser.