# HG changeset patch # User paulb # Date 1078962079 0 # Node ID 72dab6ed1872cee19061835ca7f86167c588956b # Parent 8f21e54236b789ff3226f5bcc4fec818600e807b [project @ 2004-03-10 23:41:12 by paulb] Added a test of forms. diff -r 8f21e54236b7 -r 72dab6ed1872 examples/ModPython/FormApp/FormHandler.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/ModPython/FormApp/FormHandler.py Wed Mar 10 23:41:19 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 Form import FormResource + +# NOTE: Not sure if the resource should be maintained in a resource pool. + +resource = FormResource() + +def handler(req): + global resource + return ModPython.respond(req, resource, debug=1) + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r 8f21e54236b7 -r 72dab6ed1872 examples/Twisted/FormApp.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Twisted/FormApp.py Wed Mar 10 23:41:19 2004 +0000 @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +from WebStack.Adapters import Twisted +from Form import FormResource +import twisted.web.server +import twisted.internet.reactor + +# Special magic incantation. + +top_level = Twisted.Dispatcher(FormResource()) +site = twisted.web.server.Site(top_level) +twisted.internet.reactor.listenTCP(8080, site) +twisted.internet.reactor.run() + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r 8f21e54236b7 -r 72dab6ed1872 examples/Webware/FormApp/Properties.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Webware/FormApp/Properties.py Wed Mar 10 23:41:19 2004 +0000 @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +name = "Form" + +version = (0, 1, 0) + +status = "alpha" + +releaseDate = "?" + +requiredPyVersion = (2, 2, 0) + +synopsis = "A simple WebStack application." + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r 8f21e54236b7 -r 72dab6ed1872 examples/Webware/FormApp/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Webware/FormApp/__init__.py Wed Mar 10 23:41:19 2004 +0000 @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +""" +Webware plug-in code. +""" + +__version__ = "0.1" + +from WebStack.Adapters.Webware import WebStackServletFactory +from Form import FormResource + +# NOTE: Initialising a shared resource. + +resource = FormResource() + +def InstallInWebKit(appServer): + global resource + app = appServer.application() + + # NOTE: Allow .form files only. Really, we'd like any kind of file, but + # NOTE: that would severely undermine the servlet factory concept. + + app.addServletFactory(WebStackServletFactory(app, resource, [".form"])) + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r 8f21e54236b7 -r 72dab6ed1872 examples/Webware/FormContext/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Webware/FormContext/__init__.py Wed Mar 10 23:41:19 2004 +0000 @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +""" +Webware context for the Form application (post Webware 0.8.1). +""" + +from WebStack.Adapters.Webware import WebStackURLParser +from Form import FormResource + +# NOTE: Initialising a shared resource. + +resource = FormResource() +urlParser = WebStackURLParser(resource) + +# vim: tabstop=4 expandtab shiftwidth=4