1 Introduction
2 ------------
3
4 WebStack is a package which provides a common API for Python Web
5 applications, regardless of the underlying server or framework environment.
6 It should be possible with WebStack to design and implement an application,
7 to choose a deployment environment, and then to be able to deploy the
8 application in a different environment later on without having to go back
9 and rewrite substantial parts of the application.
10
11 Quick Start
12 -----------
13
14 Try running the demo:
15
16 python tools/demo.py
17
18 Framework Support
19 -----------------
20
21 Currently, BaseHTTPRequestHandler (via BaseHTTPServer in the standard
22 library), CGI, Jython/Java Servlet API, mod_python, Twisted, Webware, WSGI
23 and Zope 2 are supported. Each framework has its own set of strengths and
24 weaknesses, but the idea is that deployment concerns can be considered
25 separately from the implementation of application functionality. Consult the
26 NOTES.txt files in each framework's subdirectory of the docs directory for
27 some notes on how applications may be run in each environment.
28
29 Tested Frameworks Release Information
30 ----------------- -------------------
31
32 BaseHTTPRequestHandler Python 2.2.2, Python 2.3.3, Python 2.4.1
33 CGI Apache 2.0.44
34 Jython/Java Servlet API Jython 2.1, Java JDK 1.3.1_02, Tomcat 4.1.27 (Servlet 2.3)
35 mod_python 3.0.3 (3.1.3 for framework cookie and session support)
36 Twisted 1.0.5, 1.3.0
37 Webware 0.8.1, CVS (2004-02-06)
38 WSGI run_with_cgi (PEP 333)
39 Zope 2.7.2-0
40
41 New in WebStack 0.9 (Changes since WebStack 0.8)
42 ------------------------------------------------
43
44 Standardised error handling in the adapters so that tracebacks can be
45 suppressed and an internal server error condition raised.
46 Added overriding of path info in transactions.
47 Added a ResourceMap resource for dispatching to different resources
48 according to path components.
49 Standardised deployment for some frameworks (see docs/deploying.html).
50 Introductory documentation in XHTML format.
51 Added server name and port methods to the transaction.
52
53 New in WebStack 0.8 (Changes since WebStack 0.7)
54 ------------------------------------------------
55
56 Added a standard exception, EndOfResponse, which can be used to immediately
57 stop the processing/production of a response; this is useful when resources
58 need to issue a redirect without unnecessary content being generated, for
59 example.
60 Fixed path information for Zope.
61 Added WSGI support.
62 Verified Twisted 1.3.0 support with Python 2.3.3.
63
64 New in WebStack 0.7 (Changes since WebStack 0.6)
65 ------------------------------------------------
66
67 Fixed path information semantics.
68 Fixed file upload semantics.
69 Fixed content type handling for Unicode output and for interpreting request
70 body fields/parameters (although some improvement remains).
71 Added a method to discover the chosen response stream encoding.
72 Fixed field/parameter retrieval so that path and body fields are distinct,
73 regardless of the framework employed.
74 Added a method to get a combination of path and body fields (suggested by Jacob
75 Smullyan).
76 Introduced Zope 2 support.
77 Improved Jython/Java Servlet API support (although a special PyServlet class
78 must now be used, and certain libraries must be deployed with applications).
79 Introduced authentication/authorisation support for Jython/Java Servlet API.
80 Session support has been added (except for Webware 0.8.1).
81 Alternative cookie support for mod_python has been added.
82 Cookie support now supports encoded Unicode sequences for names and values.
83
84 New in WebStack 0.6 (Changes since WebStack 0.5)
85 ------------------------------------------------
86
87 Introduced Jython/Java Servlet API support.
88 Minor fixes to example applications and to BaseHTTPRequestHandler.
89
90 New in WebStack 0.5 (Changes since WebStack 0.4)
91 ------------------------------------------------
92
93 Changed request body fields/parameters so that they are now represented using
94 Unicode objects rather than plain strings.
95 Introduced better support for Unicode in response streams.
96
97 New in WebStack 0.4 (Changes since WebStack 0.3)
98 ------------------------------------------------
99
100 Added application definition of user identity, permitting alternative
101 authentication mechanisms.
102 Improved BaseHTTPRequestHandler and mod_python reliability around fields from
103 request bodies.
104 Provided stream and environment parameterisation in the CGI adapter.
105 Added LoginRedirect and Login examples.
106 Added get_path_without_query and fixed get_path behaviour.
107
108 New in WebStack 0.3 (Changes since WebStack 0.2)
109 ------------------------------------------------
110
111 Added better header support for Webware (suggested by Ian Bicking).
112 Introduced CGI and Java Servlet support (the latter is currently
113 broken/unfinished).
114 Introduced support for cookies.
115
116 Future Work
117 -----------
118
119 (Essential)
120
121 JythonServlet libraries need to be configured using sys.add_package when
122 these do not feature in the compiled-in list. Adding such configuration to
123 the handler may be most appropriate (since the web.xml file can be too
124 arcane), but this needs testing.
125
126 (Important)
127
128 Things to consider for future releases: improved cookie support, redirects,
129 access to shared resources and much better documentation.
130
131 Field access needs testing, especially for anything using the cgi.FieldStorage
132 class, and the way file uploads are exposed should be reviewed (currently the
133 meta-data is not exposed). The acquisition of fields from specific sources
134 should be tested with different request methods - some frameworks provide path
135 fields in the body fields dictionary, others (eg. Zope) change the fields
136 exposed depending on request method.
137
138 Interpretation of path field encodings needs to be verified. Currently, stray
139 path fields are handled (eg. in WebStack.Helpers.Request) as being ISO-8859-1,
140 but it might be the case that some such fields might be submitted as UTF-8.
141
142 Cookie objects need defining strictly, especially since the standard library
143 Cookie object behaves differently to mod_python (and possibly Webware) Cookie
144 objects. Moreover, the set_cookie_value method needs to provide access to the
145 usual cookie parameters as supported by the frameworks. The standard library
146 Cookie module has issues with Unicode cookie names (and possibly values) -
147 this is worked around, but it would be best to resolve this comprehensively.
148
149 UTF-16 (and possibly other encodings) causes problems with HTML form data sent
150 in POST requests using the application/x-www-form-urlencoded content type.
151 This should be reviewed at a later date when proper standardisation has taken
152 place.
153
154 Session support, especially through WebStack.Helpers.Session, should be
155 reviewed and be made compatible with non-cookie mechanisms.
156
157 HeaderValue objects should be employed more extensively. Thus, the header
158 access methods may need to change their behaviour slightly.
159
160 Investigate the nicer functions in the cgi module, discarding the "magic"
161 stuff like FieldStorage.
162
163 WSGI support could demand that a special "end of headers" method be
164 introduced into WebStack, thus making response output more efficient (and
165 probably also for other frameworks, too).
166
167 The algorithm employed in the WebStack.Helpers.Auth.get_token function should
168 be reviewed and improved for better security.
169
170 Investigate proper support for HEAD, OPTIONS and other request methods.
171
172 (Completed/rejected)
173
174 The location of deployed applications in the filesystem should be exposed to
175 those applications. (This is actually available in the __file__ module
176 variable.)
177
178 Path information should be consistent across all frameworks, and the "path
179 info" value should be meaningful. (This should now be correct.)
180
181 Release Procedures
182 ------------------
183
184 Update the WebStack/__init__.py __version__ attribute.
185 Change the version number and package filename/directory in the documentation.
186 Change code examples in the documentation if appropriate.
187 Update the release notes (see above).
188 Check the setup.py file and ensure that all package directories are mentioned.
189 Tag, export.
190 Generate the PyServlet classes.
191 Generate the API documentation.
192 Archive, upload.
193
194 Generating the API Documentation
195 --------------------------------
196
197 In order to prepare the API documentation, it is necessary to generate some Web
198 pages from the Python source code. For this, the epydoc application must be
199 available on your system. Then, inside the WebStack directory, run the
200 apidocs.sh tool script as follows:
201
202 ./tools/apidocs.sh
203
204 Some warnings may be generated by the script, but the result should be a new
205 apidocs directory within the WebStack directory.