1.1 --- a/examples/Twisted/SimpleWithLoginApp.py Sat May 24 15:21:53 2008 +0000
1.2 +++ b/examples/Twisted/SimpleWithLoginApp.py Sun Aug 24 20:51:10 2008 +0200
1.3 @@ -1,35 +1,25 @@
1.4 #!/usr/bin/env python
1.5
1.6 from WebStack.Adapters.Twisted 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/myapp/login
1.15 +
1.16 +login_url = "http://localhost:8080/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 +app_url = "http://localhost:8080" # No trailing "/"!
1.22 +
1.23 +# Must match the key used elsewhere.
1.24 +
1.25 +secret_key = "horses"
1.26 +
1.27 +resource = get_site_map(app_url, login_url, secret_key)
1.28
1.29 print "Serving..."
1.30 -deploy(
1.31 - MapResource({
1.32 - "simple" :
1.33 - LoginRedirectResource(
1.34 - login_url="http://localhost:8080/login",
1.35 - app_url="http://localhost:8080",
1.36 - resource=SimpleResource(),
1.37 - authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.38 - anonymous_parameter_name="anonymous",
1.39 - logout_parameter_name="logout"
1.40 - ),
1.41 - "login" :
1.42 - LoginResource(
1.43 - LoginAuthenticator(
1.44 - secret_key="horses",
1.45 - credentials=(
1.46 - ("badger", "abc"),
1.47 - ("vole", "xyz"),
1.48 - )
1.49 - )
1.50 - )
1.51 - }),
1.52 - handle_errors=0
1.53 -)
1.54 +deploy(resource, handle_errors=0)
1.55
1.56 # vim: tabstop=4 expandtab shiftwidth=4