Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`web`.`twcgi`.`CGIDirectory``

class documentation

`class CGIDirectory(resource.Resource, filepath.FilePath[AnyStr]): (source)`

Constructor: `CGIDirectory(pathname)`

View In Hierarchy

Undocumented

Method | `__init__` | Initialize.
Method | `getChild` | Retrieve a 'child' resource from me.
Method | `render` | Render a given resource. See `IResource`'s render method.

Inherited from `Resource`:

Method | `delEntity` | Undocumented
Method | `getChildForRequest` | Deprecated in favor of `getChildForRequest`.
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 | `allowedMethods` | Undocumented
Class Variable | `isLeaf` | Signal if this IResource implementor is a "leaf node" or not. If True, getChildWithDefault will not be called on this Resource.
Class Variable | `server` | Undocumented
Instance Variable | `children` | Undocumented

Inherited from `FilePath` (via `Resource`):

Method | `__cmp__` | Undocumented
Method | `__eq__` | Undocumented
Method | `__ge__` | Undocumented
Method | `__getstate__` | Support serialization by discarding cached `os.stat` results and returning everything else.
Method | `__gt__` | Undocumented
Method | `__le__` | Undocumented
Method | `__lt__` | Undocumented
Method | `__ne__` | Undocumented
Method | `__repr__` | Undocumented
Method | `asBytesMode` | Return this `FilePath` in `bytes`-mode.
Method | `asTextMode` | Return this `FilePath` in `unicode`-mode.
Method | `basename` | Retrieve the final component of the file path's path (everything after the final path separator).
Method | `changed` | Clear any cached information about the state of this path on disk.
Method | `child` | Create and return a new `FilePath` representing a path contained by `self`.
Method | `childSearchPreauth` | Return my first existing child with a name in `paths`.
Method | `chmod` | Changes the permissions on self, if possible. Propagates errors from `os.chmod` up.
Method | `clonePath` | Make an object of the same type as this FilePath, but with path of `path`.
Method | `copyTo` | Copies self to destination.
Method | `create` | Exclusively create a file, only if this file previously did not exist.
Method | `createDirectory` | Create the directory the `FilePath` refers to.
Method | `descendant` | Retrieve a child or child's child of this path.
Method | `dirname` | Retrieve all of the components of the `FilePath`'s path except the last one (everything up to the final path separator).
Method | `exists` | Check if this `FilePath` exists.
Method | `getAccessTime` | Retrieve the time that this file was last accessed.
Method | `getDevice` | Retrieves the device containing the file. The inode number and device number together uniquely identify the file, but the device number is not necessarily consistent across reboots or system crashes.
Method | `getGroupID` | Returns the group ID of the file.
Method | `getInodeNumber` | Retrieve the file serial number, also called inode number, which distinguishes this file from all other files on the same device.
Method | `getModificationTime` | Retrieve the time of last access from this file.
Method | `getNumberOfHardLinks` | Retrieves the number of hard links to the file.
Method | `getPermissions` | Returns the permissions of the file. Should also work on Windows, however, those permissions may not be what is expected in Windows.
Method | `getsize` | Retrieve the size of this file in bytes.
Method | `getStatusChangeTime` | Retrieve the time of the last status change for this file.
Method | `getUserID` | Returns the user ID of the file's owner.
Method | `globChildren` | Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern.
Method | `isabs` | Check if this `FilePath` refers to an absolute path.
Method | `isBlockDevice` | Returns whether the underlying path is a block device.
Method | `isdir` | Check if this `FilePath` refers to a directory.
Method | `isfile` | Check if this file path refers to a regular file.
Method | `islink` | Check if this `FilePath` points to a symbolic link.
Method | `isSocket` | Returns whether the underlying path is a socket.
Method | `linkTo` | Creates a symlink to self to at the path in the `FilePath` `linkFilePath`.
Method | `listdir` | List the base names of the direct children of this `FilePath`.
Method | `makedirs` | Create all directories not yet existing in `path` segments, using `os.makedirs`.
Method | `moveTo` | Move self to destination - basically renaming self to whatever destination is named.
Method | `open` | Open this file using `mode` or for writing if `alwaysCreate` is `True`.
Method | `parent` | A file path for the directory containing the file at this file path.
Method | `parents` | Retrieve an iterator of all the ancestors of this path.
Method | `preauthChild` | Use me if `path` might have slashes in it, but you know they're safe.
Method | `realpath` | Returns the absolute target as a `FilePath` if self is a link, self otherwise.
Method | `remove` | Removes the file or directory that is represented by self. If `self.path` is a directory, recursively remove all its children before removing the directory. If it's a file or link, just delete it.
Method | `requireCreate` | Sets the `alwaysCreate` variable.
Method | `restat` | Re-calculate cached effects of 'stat'. To refresh information on this path after you know the filesystem may have changed, call this method.
Method | `setContent` | Replace the file at this path with a new file that contains the given bytes, trying to avoid data-loss in the meanwhile.
Method | `sibling` | Return a `FilePath` with the same directory as this instance but with a basename of `path`.
Method | `siblingExtension` | Attempt to return a path with my name, given the extension at `ext`.
Method | `siblingExtensionSearch` | Attempt to return a path with my name, given multiple possible extensions.
Method | `splitext` | Split the file path into a pair `(root, ext)` such that `root + ext == path`.
Method | `temporarySibling` | Construct a path referring to a sibling of this path.
Method | `touch` | Updates the access and last modification times of the file at this file path to the current time. Also creates the file if it does not already exist.
Instance Variable | `alwaysCreate` | When opening this file, only succeed if the file does not already exist.
Instance Variable | `path` | The path from which 'downward' traversal is permitted.
Property | `sep` | Return a filesystem separator.
Method | `_asBytesPath` | Return the path of this `FilePath` as bytes.
Method | `_asTextPath` | Return the path of this `FilePath` as text.
Method | `_getPathAsSameTypeAs` | If `pattern` is `bytes`, return `FilePath.path` as `bytes`. Otherwise, return `FilePath.path` as `unicode`.
Class Variable | `_chunkSize` | Undocumented
Instance Variable | `_statinfo` | Undocumented

Inherited from `AbstractFilePath` (via `Resource`, `FilePath`):

Method | `__hash__` | Hash the same as another `AbstractFilePath` with the same path as mine.
Method | `getatime` | Deprecated. Use getAccessTime instead.
Method | `getContent` | Retrieve the contents of the file at this path.
Method | `getctime` | Deprecated. Use getStatusChangeTime instead.
Method | `getmtime` | Deprecated. Use getModificationTime instead.
Method | `segmentsFrom` | Return a list of segments between a child and its ancestor.
Method | `walk` | Yield myself, then each of my children, and each of those children's children in turn.
Type Variable | `Selfish` | Undocumented

def __init__(self, pathname): (source)
overrides `twisted.web.resource.Resource.__init__`

Initialize.

def getChild(self, path, request): (source)
overrides `twisted.web.resource.Resource.getChild`

Retrieve a 'child' resource from me.

Implement this to create dynamic resource generation -- resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable 'isLeaf' is set in your subclass; instead, the 'postpath' attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

      | site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by 'bar' has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by `IResource.getChildWithDefault`.

def render(self, request): (source)
from `twisted.web.resource.IResource`
overrides `twisted.web.resource.Resource.render`

Render a given resource. See `IResource`'s render method.

I delegate to methods of self with the form 'render_METHOD' where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is `server.NOT_DONE_YET`, in which case it is this class's responsibility to write the results using `request.write(data)` and then call `request.finish()`.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

See Also
`IResource.render`