1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/WSGI/SimpleWithLoginApp.py Thu Sep 27 22:40:25 2007 +0000
1.3 @@ -0,0 +1,41 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +# Uncomment and adjust the paths below if WebStack is not installed somewhere
1.7 +# on the PYTHONPATH.
1.8 +
1.9 +#import sys
1.10 +#sys.path.append("/home/paulb/Software/Python/WebStack")
1.11 +#sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")
1.12 +
1.13 +from WebStack.Adapters.WSGI import deploy
1.14 +from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
1.15 +from WebStack.Resources.Login import LoginResource, LoginAuthenticator
1.16 +from WebStack.Resources.ResourceMap import MapResource
1.17 +from Simple import SimpleResource
1.18 +
1.19 +deploy(
1.20 + MapResource({
1.21 + "simple" :
1.22 + LoginRedirectResource(
1.23 + login_url="http://localhost:8080/login",
1.24 + app_url="http://localhost:8080",
1.25 + resource=SimpleResource(),
1.26 + authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.27 + anonymous_parameter_name="anonymous",
1.28 + logout_parameter_name="logout"
1.29 + ),
1.30 + "login" :
1.31 + LoginResource(
1.32 + LoginAuthenticator(
1.33 + secret_key="horses",
1.34 + credentials=(
1.35 + ("badger", "abc"),
1.36 + ("vole", "xyz"),
1.37 + )
1.38 + )
1.39 + )
1.40 + }),
1.41 + handle_errors=1
1.42 +)
1.43 +
1.44 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/examples/WSGI/SimpleWithLoginHandler.py Thu Sep 27 22:39:38 2007 +0000
2.2 +++ b/examples/WSGI/SimpleWithLoginHandler.py Thu Sep 27 22:40:25 2007 +0000
2.3 @@ -7,19 +7,35 @@
2.4 #sys.path.append("/home/paulb/Software/Python/WebStack")
2.5 #sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")
2.6
2.7 -from WebStack.Adapters.WSGI import deploy
2.8 +from WebStack.Adapters.WSGI import deploy_as_cgi
2.9 from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
2.10 +from WebStack.Resources.Login import LoginResource, LoginAuthenticator
2.11 +from WebStack.Resources.ResourceMap import MapResource
2.12 from Simple import SimpleResource
2.13
2.14 -deploy(
2.15 - LoginRedirectResource(
2.16 - login_url="http://localhost/wsgi/login",
2.17 - app_url="http://localhost",
2.18 - resource=SimpleResource(),
2.19 - authenticator=LoginRedirectAuthenticator(secret_key="horses"),
2.20 - anonymous_parameter_name="anonymous",
2.21 - logout_parameter_name="logout"
2.22 - )
2.23 +deploy_as_cgi(
2.24 + MapResource({
2.25 + "simple" :
2.26 + LoginRedirectResource(
2.27 + login_url="http://localhost/wsgi/login",
2.28 + app_url="http://localhost",
2.29 + resource=SimpleResource(),
2.30 + authenticator=LoginRedirectAuthenticator(secret_key="horses"),
2.31 + anonymous_parameter_name="anonymous",
2.32 + logout_parameter_name="logout"
2.33 + ),
2.34 + "login" :
2.35 + LoginResource(
2.36 + LoginAuthenticator(
2.37 + secret_key="horses",
2.38 + credentials=(
2.39 + ("badger", "abc"),
2.40 + ("vole", "xyz"),
2.41 + )
2.42 + )
2.43 + )
2.44 + }),
2.45 + handle_errors=1
2.46 )
2.47
2.48 # vim: tabstop=4 expandtab shiftwidth=4