source: TI12-security/trunk/python/Tests/openid-provider/op/op/controllers/template.py @ 4081

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/Tests/openid-provider/op/op/controllers/template.py@4081
Revision 4081, 849 bytes checked in by pjkersha, 11 years ago (diff)

First working version of an OpenID Provider as opposed to a Relying Party as avail. with AuthKit?. The code is taken from the HTTPServer example in the Python OpenID package and refactored into WSGI middleware.

  • ndg.security.server.wsgi.openid_provider - WSGI middleware package
  • Tests/openid-provider/op: pylons project test harness for the above

TODO: integrate into AuthKit? and Beaker Session Middleware as required.

Line 
1from op.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.