Package aquarium :: Package wsadaptor :: Module ModPythonAdaptor :: Class ModPythonAdaptor
[show private | hide private]
[frames | no frames]

Class ModPythonAdaptor

WebServerAdaptor --+
                   |
                  ModPythonAdaptor


This subclass of WebServerAdaptor is for mod_python.

There are many ways to configure mod_python. In the example below, any request for "/aquarium" is given to Aquarium. Note that this configuration even removes the need for a separate entry point:

<Location "/aquarium">
    # Update your path, if necessary:
    # PythonPath "sys.path + ['/path/to']"
    SetHandler python-program
    PythonHandler aquarium.wsadaptor.ModPythonAdaptor
    PythonOption AQUARIUM_PACKAGE_PATH /var/www/site-packages
    PythonDebug On
</Location>

Be careful if you are using SELinux. It can cause errors that look like Aquarium is not even installed! Keep an eye on both the server log and /var/log/messages if things aren't working.

The following urlscheme modules can be used with this Web server adaptor: QueryParameters, PathInfo.

The following attributes are used:

req
This is the request object given to us by mod_python.

Method Summary
  __init__(self, req)
Receive the request object.
  getCgiEnv(self)
Return CGI-like environmental variables.
  getForm(self)
Instantiate some cgi.FieldStorage and return the instance.
  setResponseCode(self, code, _ModPythonAdaptor__ignored_msg)
Set the Web server response code and message.
  write(self, s)
Output a string.
  writeHeaders(self, headersList)
Output a list of header strings.

Method Details

__init__(self, req)
(Constructor)

Receive the request object.

getCgiEnv(self)

Return CGI-like environmental variables.

Overrides:
aquarium.wsadaptor.WebServerAdaptor.WebServerAdaptor.getCgiEnv

getForm(self)

Instantiate some cgi.FieldStorage and return the instance.

Overrides:
aquarium.wsadaptor.WebServerAdaptor.WebServerAdaptor.getForm

setResponseCode(self, code=None, _ModPythonAdaptor__ignored_msg=None)

Set the Web server response code and message.

Keword arguments:

code
The default means "OK".
__ignored_msg
This is an unused part of the API.
Overrides:
aquarium.wsadaptor.WebServerAdaptor.WebServerAdaptor.setResponseCode

write(self, s)

Output a string.

Overrides:
aquarium.wsadaptor.WebServerAdaptor.WebServerAdaptor.write

writeHeaders(self, headersList)

Output a list of header strings.

The list will contains tuples like:

("Content-type", "text/html")
Overrides:
aquarium.wsadaptor.WebServerAdaptor.WebServerAdaptor.writeHeaders

Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 http://epydoc.sf.net