1.15.4.1 web.wsgi.cgi - CGI Variable Access

The web.wsgi.cgi module provides one class CGI which adds the key 'web.cgi' to the environ dictionary. Middleware or applications further down the chain can access CGI variables usually accessed through the web.cgi object by using environ['web.cgi']. The class takes no arguments.

For example:

import web.wsgi.base, web.wsgi.cgi

class Application(web.wsgi.base.BaseApplication):
    def start(self):
        if self.environ['web.cgi'].has_key('test') and self.environ['web.cgi']['test'].value == 'True':
            self.output('<html>You visited the URL</html>')
        else:
            self.output('<html><a href="?test=True">Visit URL</a></html>')

application = web.wsgi.cgi.CGI(Application())