1.1 --- a/examples/CGI/SimpleWithLoginHandler.py Sat May 24 15:21:53 2008 +0000
1.2 +++ b/examples/CGI/SimpleWithLoginHandler.py Sun Aug 24 20:51:10 2008 +0200
1.3 @@ -8,38 +8,24 @@
1.4 #sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")
1.5
1.6 from WebStack.Adapters.CGI import deploy
1.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
1.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator
1.9 -from WebStack.Resources.ResourceMap import MapResource
1.10 -from Simple import SimpleResource
1.11 +from SimpleWithLogin import get_site_map
1.12 +
1.13 +# Change this to be the exact URL.
1.14 +# eg. http://localhost:8000/cgi/myapp/requestid
1.15 +
1.16 +login_url = "http://localhost/cgi/simplewithlogin/login"
1.17 +
1.18 +# Change this to be the URL base for your server.
1.19 +# eg. http://localhost:8000
1.20
1.21 -deploy(
1.22 - MapResource({
1.23 - "simple" :
1.24 - LoginRedirectResource(
1.25 - login_url="http://localhost/cgi/login", # Change this to be the exact URL on your server.
1.26 - # eg. http://localhost:8000/cgi/LoginHandler.py
1.27 - app_url="http://localhost", # Change this to be the URL base for your server.
1.28 - # eg. http://localhost:8000
1.29 - # Note that the login application can be placed on
1.30 - # a different server if desirable.
1.31 - resource=SimpleResource(),
1.32 - authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.33 - anonymous_parameter_name="anonymous",
1.34 - logout_parameter_name="logout"
1.35 - ),
1.36 - "login" :
1.37 - LoginResource(
1.38 - LoginAuthenticator(
1.39 - secret_key="horses",
1.40 - credentials=(
1.41 - ("badger", "abc"),
1.42 - ("vole", "xyz"),
1.43 - )
1.44 - )
1.45 - )
1.46 - }),
1.47 - handle_errors=0
1.48 -)
1.49 +app_url = "http://localhost" # No trailing "/"!
1.50 +
1.51 +# Must match the key used elsewhere.
1.52 +
1.53 +secret_key = "horses"
1.54 +
1.55 +resource = get_site_map(app_url, login_url, secret_key)
1.56 +
1.57 +deploy(resource, handle_errors=0)
1.58
1.59 # vim: tabstop=4 expandtab shiftwidth=4