source: TI12-security/trunk/NDGSecurity/python/Tests/pylonsAttributeAuthority/ndgsecurity/ndgsecurity/controllers/template.py @ 7080

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/Tests/pylonsAttributeAuthority/ndgsecurity/ndgsecurity/controllers/template.py@7080
Revision 7080, 858 bytes checked in by pjkersha, 9 years ago (diff)
  • Property svn:keywords set to Id
Line 
1from ndgsecurity.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.