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

Subversion URL:
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.

  • - WSGI middleware package
  • Tests/openid-provider/op: pylons project test harness for the above

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

1from op.lib.base import *
3class TemplateController(BaseController):
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.::
10            def view(self, url):
11                return render('/%s' % url)
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::
16            import mako.exceptions
18            def view(self, url):
19                try:
20                    return render('/%s' % url)
21                except mako.exceptions.TopLevelLookupException:
22                    abort(404)
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.