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