WebStack

Annotated examples/ModPython/AuthApp/AuthHandler.py

384:c55f7676936f
2005-05-01 paulb [project @ 2005-05-01 18:26:19 by paulb] Added a note about .pyc files.
paulb@55 1
#!/usr/bin/env python
paulb@55 2
paulb@55 3
# NOTE: Path manipulation requires manual customisation.
paulb@55 4
paulb@55 5
import sys
paulb@55 6
sys.path.append("/home/paulb/Software/Python/WebStack")
paulb@55 7
sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")
paulb@55 8
paulb@55 9
from WebStack.Adapters import ModPython
paulb@80 10
from Auth import AuthResource, AuthAuthenticator
paulb@55 11
paulb@55 12
# NOTE: Not sure if the resource should be maintained in a resource pool.
paulb@55 13
paulb@55 14
resource = AuthResource()
paulb@80 15
authenticator = AuthAuthenticator()
paulb@55 16
paulb@55 17
def handler(req):
paulb@55 18
    global resource
paulb@341 19
    return ModPython.respond(req, resource, handle_errors=0)
paulb@80 20
paulb@80 21
def authenhandler(req):
paulb@80 22
    global authenticator
paulb@341 23
    return ModPython.authenticate(req, authenticator, handle_errors=0)
paulb@55 24
paulb@55 25
# vim: tabstop=4 expandtab shiftwidth=4