1.1 --- a/examples/Twisted/SimpleWithLoginApp.py Thu Mar 24 17:40:50 2005 +0000
1.2 +++ b/examples/Twisted/SimpleWithLoginApp.py Thu Mar 24 17:41:03 2005 +0000
1.3 @@ -1,26 +1,19 @@
1.4 #!/usr/bin/env python
1.5
1.6 -from WebStack.Adapters import Twisted
1.7 +from WebStack.Adapters.Twisted import deploy
1.8 from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
1.9 from Simple import SimpleResource
1.10 -import twisted.web.server
1.11 -import twisted.internet.reactor
1.12
1.13 -# Special magic incantation.
1.14 -
1.15 -resource = LoginRedirectResource(
1.16 - login_url="http://localhost:8081",
1.17 - app_url="http://localhost:8080",
1.18 - resource=SimpleResource(),
1.19 - authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.20 - anonymous_parameter_name="anonymous",
1.21 - logout_parameter_name="logout"
1.22 +print "Serving..."
1.23 +deploy(
1.24 + LoginRedirectResource(
1.25 + login_url="http://localhost:8081",
1.26 + app_url="http://localhost:8080",
1.27 + resource=SimpleResource(),
1.28 + authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.29 + anonymous_parameter_name="anonymous",
1.30 + logout_parameter_name="logout"
1.31 + )
1.32 )
1.33
1.34 -top_level = Twisted.Dispatcher(resource)
1.35 -site = twisted.web.server.Site(top_level)
1.36 -twisted.internet.reactor.listenTCP(8080, site)
1.37 -print "Serving..."
1.38 -twisted.internet.reactor.run()
1.39 -
1.40 # vim: tabstop=4 expandtab shiftwidth=4