"""This subclass of ``WebServerAdaptor`` is for CGI environments."""
__docformat__ = "restructuredtext"
# Created: Fri Apr 13 19:10:54 PDT 2001
# Author: Shannon -jj Behrens
# Email: jjinux@users.sourceforge.net
#
# Copyright (c) Shannon -jj Behrens. All rights reserved.
from os import environ
import cgi
from WebServerAdaptor import WebServerAdaptor
class CGIAdaptor(WebServerAdaptor):
"""This subclass of WebServerAdaptor_ is for CGI environments.
Here is a minimal CGI entry point. Naturally, you'll almost assuredly want
to add code to update ``sys.path`` and ``packagePath`` *before* importing
anything from Aquarium::
#!/usr/bin/python
from aquarium.util.Aquarium import Aquarium
from aquarium.wsadaptor.CGIAdaptor import CGIAdaptor
Aquarium(CGIAdaptor())()
The following urlscheme modules can be used with this Web server adaptor:
QueryParameters_, PathInfo_.
.. _WebServerAdaptor:
aquarium.wsadaptor.WebServerAdaptor.WebServerAdaptor-class.html
.. _QueryParameters:
aquarium.urlscheme.QueryParameters.QueryParameters-class.html
.. _PathInfo:
aquarium.urlscheme.PathInfo.PathInfo-class.html
"""
def getCgiEnv(self):
"""Return CGI-like environmental variables."""
return environ
def getForm(self):
"""Instantiate some ``cgi.FieldStorage`` and return the instance."""
return cgi.FieldStorage()
|