1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/Twisted/SimpleWithLoginApp.py Sat May 29 23:07:08 2004 +0000
1.3 @@ -0,0 +1,24 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +from WebStack.Adapters import Twisted
1.7 +from Simple import SimpleResource
1.8 +from LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
1.9 +import twisted.web.server
1.10 +import twisted.internet.reactor
1.11 +
1.12 +# Special magic incantation.
1.13 +
1.14 +resource = LoginRedirectResource(
1.15 + login_url="http://localhost:8081",
1.16 + app_url="http://localhost:8080",
1.17 + resource=SimpleResource(),
1.18 + authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.19 + anonymous_parameter_name="anonymous"
1.20 +)
1.21 +
1.22 +top_level = Twisted.Dispatcher(resource)
1.23 +site = twisted.web.server.Site(top_level)
1.24 +twisted.internet.reactor.listenTCP(8080, site)
1.25 +twisted.internet.reactor.run()
1.26 +
1.27 +# vim: tabstop=4 expandtab shiftwidth=4