1.1 --- a/README.txt Sat Apr 30 20:44:03 2005 +0000
1.2 +++ b/README.txt Sat Apr 30 21:23:30 2005 +0000
1.3 @@ -8,6 +8,13 @@
1.4 application in a different environment later on without having to go back
1.5 and rewrite substantial parts of the application.
1.6
1.7 +Quick Start
1.8 +-----------
1.9 +
1.10 +Try running the demo:
1.11 +
1.12 +python tools/demo.py
1.13 +
1.14 Framework Support
1.15 -----------------
1.16
1.17 @@ -22,7 +29,7 @@
1.18 Tested Frameworks Release Information
1.19 ----------------- -------------------
1.20
1.21 -BaseHTTPRequestHandler Python 2.2.2, Python 2.3.3
1.22 +BaseHTTPRequestHandler Python 2.2.2, Python 2.3.3, Python 2.4.1
1.23 CGI Apache 2.0.44
1.24 Jython/Java Servlet API Jython 2.1, Java JDK 1.3.1_02, Tomcat 4.1.27 (Servlet 2.3)
1.25 mod_python 3.0.3 (3.1.3 for framework cookie and session support)
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/examples/BaseHTTPRequestHandler/DemoApp.py Sat Apr 30 21:23:30 2005 +0000
2.3 @@ -0,0 +1,70 @@
2.4 +#!/usr/bin/env python
2.5 +
2.6 +"""
2.7 +A demonstration of WebStack. This is a quick and dirty combination of an
2.8 +adapter, employing lots of resources, and the index page resource.
2.9 +"""
2.10 +
2.11 +# Import the things which make the adapter code deploy the application.
2.12 +
2.13 +from WebStack.Adapters.BaseHTTPRequestHandler import deploy
2.14 +from WebStack.Resources.ResourceMap import MapResource
2.15 +
2.16 +# Here are all the test resources.
2.17 +
2.18 +from Cookies import CookiesResource
2.19 +from Form import FormResource
2.20 +from Sessions import SessionsResource
2.21 +from Simple import SimpleResource
2.22 +from Unicode import UnicodeResource
2.23 +from VerySimple import VerySimpleResource
2.24 +
2.25 +# A very simple index page.
2.26 +
2.27 +from WebStack.Generic import ContentType
2.28 +
2.29 +class DemoResource:
2.30 + def respond(self, trans):
2.31 + trans.set_content_type(ContentType("text/html"))
2.32 + trans.get_response_stream().write("""
2.33 +<html>
2.34 + <head>
2.35 + <title>WebStack Examples</title>
2.36 + </head>
2.37 + <body>
2.38 + <h1>WebStack Examples</h1>
2.39 + <p>Here are some of the examples supplied with WebStack:</p>
2.40 + <ul>
2.41 + <li><a href="cookies">Cookie information</a></li>
2.42 + <li><a href="form">Form tests</a></li>
2.43 + <li><a href="sessions">Session information</a></li>
2.44 + <li><a href="simple">Simple test</a></li>
2.45 + <li><a href="unicode">Unicode test</a></li>
2.46 + <li><a href="verysimple">Very simple test</a></li>
2.47 + </ul>
2.48 + <p>You can run all of the examples independently - see the documentation in
2.49 + the <code>docs</code> directory, especially the subdirectories for each
2.50 + of the server environments or frameworks, for details of how this is
2.51 + done.</p>
2.52 + </body>
2.53 +</html>""")
2.54 + trans.set_response_code(200)
2.55 +
2.56 +# Define the resource mapping.
2.57 +
2.58 +resource = MapResource({
2.59 + "cookies" : CookiesResource(),
2.60 + "form" : FormResource(),
2.61 + "sessions" : SessionsResource(),
2.62 + "simple" : SimpleResource(),
2.63 + "unicode" : UnicodeResource(),
2.64 + "verysimple" : VerySimpleResource(),
2.65 + "" : DemoResource(),
2.66 + })
2.67 +
2.68 +# Special magic incantation.
2.69 +
2.70 +print "Serving..."
2.71 +deploy(resource, handle_errors=0)
2.72 +
2.73 +# vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tools/demo.py Sat Apr 30 21:23:30 2005 +0000
3.3 @@ -0,0 +1,20 @@
3.4 +#!/usr/bin/env python
3.5 +
3.6 +"Start the demonstration program."
3.7 +
3.8 +import os, sys
3.9 +
3.10 +# Find out where WebStack's distribution directory is.
3.11 +
3.12 +cwd = os.getcwd()
3.13 +parts = os.path.split(cwd)
3.14 +if parts[-1] == "tools":
3.15 + parts = parts[:-1]
3.16 +base = os.path.join(*parts)
3.17 +
3.18 +# Set up the environment and run the demo program.
3.19 +
3.20 +os.environ["PYTHONPATH"] = "%s:%s" % (base, os.path.join(base, "examples", "Common"))
3.21 +os.system("%s %s" % (sys.executable, os.path.join(base, "examples", "BaseHTTPRequestHandler", "DemoApp.py")))
3.22 +
3.23 +# vim: tabstop=4 expandtab shiftwidth=4