WebStack

Annotated examples/Webware/AuthApp/__init__.py

604:9b47d24643ff
2007-01-10 paulb [project @ 2007-01-10 22:27:27 by paulb] Added missing Error module.
paulb@59 1
#!/usr/bin/env python
paulb@59 2
paulb@59 3
"""
paulb@59 4
Webware plug-in code.
paulb@59 5
"""
paulb@59 6
paulb@59 7
__version__ = "0.1"
paulb@59 8
paulb@59 9
from WebStack.Adapters.Webware import WebStackServletFactory
paulb@84 10
from Auth import AuthResource, AuthAuthenticator
paulb@59 11
paulb@59 12
# NOTE: Initialising a shared resource.
paulb@59 13
paulb@59 14
resource = AuthResource()
paulb@84 15
authenticator = AuthAuthenticator()
paulb@59 16
paulb@59 17
def InstallInWebKit(appServer):
paulb@84 18
    global resource, authenticator
paulb@59 19
    app = appServer.application()
paulb@59 20
paulb@59 21
    # NOTE: Allow .auth files only. Really, we'd like any kind of file, but
paulb@59 22
    # NOTE: that would severely undermine the servlet factory concept.
paulb@59 23
paulb@84 24
    app.addServletFactory(WebStackServletFactory(app, resource, [".auth"], authenticator))
paulb@59 25
paulb@59 26
# vim: tabstop=4 expandtab shiftwidth=4