1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/ModPython/SessionsApp/SessionsHandler.py Sun Sep 05 15:53:03 2004 +0000
1.3 @@ -0,0 +1,20 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +# NOTE: Path manipulation requires manual customisation.
1.7 +
1.8 +import sys
1.9 +sys.path.append("/home/paulb/Software/Python/WebStack")
1.10 +sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")
1.11 +
1.12 +from WebStack.Adapters import ModPython
1.13 +from Sessions import SessionsResource
1.14 +
1.15 +# NOTE: Not sure if the resource should be maintained in a resource pool.
1.16 +
1.17 +resource = SessionsResource()
1.18 +
1.19 +def handler(req):
1.20 + global resource
1.21 + return ModPython.respond(req, resource, debug=1)
1.22 +
1.23 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/examples/Twisted/SessionsApp.py Sun Sep 05 15:53:03 2004 +0000
2.3 @@ -0,0 +1,15 @@
2.4 +#!/usr/bin/env python
2.5 +
2.6 +from WebStack.Adapters import Twisted
2.7 +from Sessions import SessionsResource
2.8 +import twisted.web.server
2.9 +import twisted.internet.reactor
2.10 +
2.11 +# Special magic incantation.
2.12 +
2.13 +top_level = Twisted.Dispatcher(SessionsResource())
2.14 +site = twisted.web.server.Site(top_level)
2.15 +twisted.internet.reactor.listenTCP(8080, site)
2.16 +twisted.internet.reactor.run()
2.17 +
2.18 +# vim: tabstop=4 expandtab shiftwidth=4