CGIManager

This class is intended to serve as the basic implementation of a CGI dispatcher. It routes a CGIRequest to python objects and modules that service the request.

This class uses the path information associated with the request to determine how the request is routed. If there is no path info associated with the request, the defaultHandler() method is called.

If the first component of the path is an object stored in the managers object dictionary, the request goes to the object. If the object is a CGIObject, the rest of the path information is ignored and the object's processRequest() method is called. For any other kind of object, if there is a second path component, the manager will attempt to call a method of that name on the object. If there is no second path component, the object itself will be called.

If the first component is not an object stored in the manager, the manager checks to see if there is a python module in the current working directory of that name. In this case, there must be a second path component and it is the function that is called within the module. The module will be reloaded if its file has been changed since the last time that it was loaded, making the CGIManager very well suited to interactive debugging.

All functions and methods (including processRequest()) that are provided to the manager must accept the following argument list:

manager

The CGIManager instance that is initiating the call.

request

The CGIRequest object.

response

The CGIResponse object.

The CGIManager can be used within the context of stand-alone CGI programs, but it is really designed to be housed in a running process into which smaller cgi programs can feed it requests, either through distributed object method invocations or some other means.

Methods

__init__(self)

   def __init__(self):

__loadModule(self, moduleName)

   def __loadModule(self, moduleName):

addObject(self, key, val)

   def addObject(self, key, val):

defaultHandler(self, request, response)

   def defaultHandler(self, request, response):

error(self, request, response)

   def error(self, request, response):

process(self, request, response)

   def process(self, request, response = None):

removeObject(self, key)

   def removeObject(self, key):

test(self, request, response)

   def test(self, request, response):