CGI Wrapper (WebKit for Python)

# CGI Wrapper

### Done

- 2000-@@-@@ ver 0.2 - ALPHA
  - 2000-04-25 ce
    - sys.exit(0), which throws an exception, is now detected and handled gracefully. i.e., the wrapper no longer reports it as an error
  - 2000-04-24 ce
    - Major updates to the documentation to reflect the past few days work, plus table of contents, section anchors, etc.
    - Killed ClassExample.py. See _admin.py and other "underscore" scripts for a good example of class-cased CGIs.
    - Enhanced the admin error log to provide a link to the archived error messages (which are plain HTML files). This was prompted the discovery and fix described just below.
    - Found a bad glitch: a relative URL that points to a non-script file that is embedded in a page from a CGI script will end up hitting "server.cgi" which then barfs on the non-script. I fixed up CGI Wrapper. The new policy is that anything with an extension is re-served with a "Location:" header. Anything without an extension is assumed to be a Python script.
    - Got rid of special __info__ URL and supporting showInfo() method. Use _admin URL and look at _admin.py script instead.
    - Pulled CGIWrapperUtils.py into CGIWrapper.
    - The integration with class-based CGIs can now be configured with the 'ClassNames' setting which is an array of names attempted in order. The empty string means the same name as the script.
    - Use cStringIO, but catch ImportError and use StringIO if it's not avail. Haven't compared performance.
    - The Scripts.csv log can now be configured by the ScriptLogColumns setting which is an array of names. I used KeyValueAccess for this. Pretty sweet.
  - 2000-04-23 ce
    - Created KeyValueAccess class in Webware's MiddleKit package and made that the superclass of CGIWrapper. (The purpose being for the new ScriptLogColumns setting.)
    - Added "e-mail errors" feature.
    - Renamed go() to serve().
  - 2000-04-21 ce
    - Removed special __info__ URL and added _admin page which shows basic info and a menu for the script log, error log and configuration. Added _dumpCSV and _config. Created AdminPage base class for all admin scripts.
    - Scripts that start with an underscore should be run out of the CGI Wrapper's directory. This will be used for CGI Wrapper support scripts.
    - Wrapper: The script log should print a header line the first time the file ever gets written to.
    - Renamed ErrorMessage setting to UserErrorMessage.
    - handleException()
      - Added settings, ErrorLogFilename, SaveErrorMessages, ErrorMessagesDir.
      - Added error logging to 'Errors.csv'.
      - HTML error message pages are now saved to a file that can reviewed later by the developer/administrator.
      - Broke out the functionality of handleException() into methods that can be overriden.
    - Docs: Should include an example error page.
- 2000-04-19 ver 0.1
  - 2000-04-16 ce
    - Document the OO hook.
    - The traceback on errors is not colorized like in WebKit.
    - Message to stderr should include a timestamp.
    - Review the names of the settings.
    - Add a special version URL that reports the version of the CGI wrapper.
    - Describe the hook for cookies.
    - Rename 'env' global to 'environ' to match os.
  - 2000-04-15 ce
    - Document the globals that are passed to the CGI script and that scripts should use 'env'.
    - Revamp the CGI Wrapper into a class that could then be subclassed and customized.
    - The target script should also have a "wrapper" variable that points back to the CGI Wrapper.
    - The current directory is not changed to the location of the script.
    - The Colors example script does not compute brightness correctly.
    - Some of the config info is hard coded so you have to change the script source.
    - Import target scripts rather than reading & execing their source. Note: Python doesn't seem to allow any backdoors for passing global vars to an import, so this may not be reasonably possible. 2000-04-09: Looks like execfile() can take care of this.
    - Explain in docs that Server.cgi also forces byte code caching of server.py.
    - The View example script should probably accept a variable tabsize and then use string.expandtabs.
    - The View example script doesn't do its HTML encoding very well. Also, maybe it should use WebUtils.
  - 2000-04-10 ce
    - There's a bug in writing the script log at run time.
  - < 2000-04-10 ce
    - A bunch of stuff.