# ``twisted`.`web`.`twcgi`.`CGIScript``

class documentation

`class CGIScript(resource.Resource): (source)`

Known subclasses: `twisted.web.twcgi.FilteredScript`

View In Hierarchy

`CGIScript` is a resource which runs child processes according to the CGI specification.

The implementation is complex due to the fact that it requires asynchronous IPC with an external process with an unpleasant protocol.

Method | `__init__` | Initialize, with the name of a CGI script file.
Method | `render` | Do various things to conform to the CGI specification.
Method | `runProcess` | Run the cgi script.
Class Variable | `isLeaf` | Signal if this IResource implementor is a "leaf node" or not. If True, getChildWithDefault will not be called on this Resource.
Instance Variable | `filename` | Undocumented
Instance Variable | `_reactor` | Undocumented

Inherited from `Resource`:

Method | `delEntity` | Undocumented
Method | `getChild` | Retrieve a 'child' resource from me.
Method | `getChildForRequest` | Undocumented
Method | `getChildWithDefault` | Retrieve a static or dynamically generated child resource from me.
Method | `getDynamicEntity` | Undocumented
Method | `getStaticEntity` | Undocumented
Method | `listDynamicEntities` | Undocumented
Method | `listDynamicNames` | Undocumented
Method | `listEntities` | Undocumented
Method | `listNames` | Undocumented
Method | `listStaticEntities` | Undocumented
Method | `listStaticNames` | Undocumented
Method | `putChild` | Register a static child.
Method | `reallyPutEntity` | Undocumented
Method | `render_HEAD` | Default handling of HEAD method.
Class Variable | `server` | Undocumented
Instance Variable | `children` | Undocumented

def __init__(self, filename, registry=None, reactor=None): (source)
overrides `twisted.web.resource.Resource.__init__`
Initialize, with the name of a CGI script file.
def render(self, request): (source)
from `twisted.web.resource.IResource`
overrides `twisted.web.resource.Resource.render`

Do various things to conform to the CGI specification.

I will set up the usual slew of environment variables, then spin off a process.

Parameters
request:`twisted.web.http.Request` | An HTTP request.

def runProcess(self, env, request, qargs=[]): (source)
overridden in `twisted.web.twcgi.FilteredScript`
Run the cgi script.

Parameters
env:A `dict` of `str`, or `None` | The environment variables to pass to the process that will get spawned. See `twisted.internet.interfaces.IReactorProcess.spawnProcess` for more information about environments and process creation.
request:`twisted.web.http.Request` | An HTTP request.
qargs:A `list` of `str` | The command line arguments to pass to the process that will get spawned.

isLeaf: `int` = (source)
from `twisted.web.resource.IResource`
overrides `twisted.web.resource.Resource.isLeaf`
Signal if this IResource implementor is a "leaf node" or not. If True, getChildWithDefault will not be called on this Resource.
filename = (source)

Undocumented

_reactor = (source)

Undocumented