# HG changeset patch # User paulb # Date 1094399583 0 # Node ID 43664872bab12ce1ee08f026f9c106a91b10840b # Parent c7b3683732eba1a5ae88c893714e128505eccee4 [project @ 2004-09-05 15:53:01 by paulb] Added the session example for frameworks using WebStack.Helpers.Session. diff -r c7b3683732eb -r 43664872bab1 examples/ModPython/SessionsApp/SessionsHandler.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/ModPython/SessionsApp/SessionsHandler.py Sun Sep 05 15:53:03 2004 +0000 @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# NOTE: Path manipulation requires manual customisation. + +import sys +sys.path.append("/home/paulb/Software/Python/WebStack") +sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") + +from WebStack.Adapters import ModPython +from Sessions import SessionsResource + +# NOTE: Not sure if the resource should be maintained in a resource pool. + +resource = SessionsResource() + +def handler(req): + global resource + return ModPython.respond(req, resource, debug=1) + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r c7b3683732eb -r 43664872bab1 examples/Twisted/SessionsApp.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Twisted/SessionsApp.py Sun Sep 05 15:53:03 2004 +0000 @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +from WebStack.Adapters import Twisted +from Sessions import SessionsResource +import twisted.web.server +import twisted.internet.reactor + +# Special magic incantation. + +top_level = Twisted.Dispatcher(SessionsResource()) +site = twisted.web.server.Site(top_level) +twisted.internet.reactor.listenTCP(8080, site) +twisted.internet.reactor.run() + +# vim: tabstop=4 expandtab shiftwidth=4