WebStack

Annotated examples/ModPython/SimpleWithLoginApp/SimpleWithLoginHandler.py

384:c55f7676936f
2005-05-01 paulb [project @ 2005-05-01 18:26:19 by paulb] Added a note about .pyc files.
paulb@139 1
#!/usr/bin/env python
paulb@139 2
paulb@139 3
# NOTE: Path manipulation requires manual customisation.
paulb@139 4
paulb@139 5
import sys
paulb@139 6
sys.path.append("/home/paulb/Software/Python/WebStack")
paulb@139 7
sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")
paulb@139 8
paulb@139 9
from WebStack.Adapters import ModPython
paulb@154 10
from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
paulb@139 11
from Simple import SimpleResource
paulb@139 12
paulb@139 13
# NOTE: Not sure if the resource should be maintained in a resource pool.
paulb@139 14
paulb@139 15
resource = LoginRedirectResource(
paulb@139 16
    login_url="http://localhost/login/app.login",
paulb@139 17
    app_url="http://localhost",
paulb@139 18
    resource=SimpleResource(),
paulb@139 19
    authenticator=LoginRedirectAuthenticator(secret_key="horses"),
paulb@153 20
    anonymous_parameter_name="anonymous",
paulb@153 21
    logout_parameter_name="logout",
paulb@153 22
    use_logout_redirect=0
paulb@139 23
)
paulb@139 24
paulb@139 25
def handler(req):
paulb@139 26
    global resource
paulb@341 27
    return ModPython.respond(req, resource, handle_errors=0)
paulb@139 28
paulb@139 29
# vim: tabstop=4 expandtab shiftwidth=4