t.w.t.CGIDirectory(resource.Resource, filepath.FilePath) : class documentation

Part of twisted.web.twcgi View Source 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 listStaticNames Undocumented
Method listStaticEntities Undocumented
Method listNames Undocumented
Method listEntities Undocumented
Method listDynamicNames Undocumented
Method listDynamicEntities Undocumented
Method getStaticEntity Undocumented
Method getDynamicEntity Undocumented
Method delEntity Undocumented
Method reallyPutEntity Undocumented
Method getChildWithDefault Retrieve a static or dynamically generated child resource from me.
Method getChildForRequest Undocumented
Method putChild Register a static child.
Method render_HEAD Default handling of HEAD method.

Inherited from FilePath:

Instance Variable alwaysCreate When opening this file, only succeed if the file does not already exist. (type: bool)
Instance Variable path The path from which 'downward' traversal is permitted. (type: str)
Instance Variable statinfo The currently cached status information about the file on the filesystem that this FilePath points to. This attribute is None if the file is in an indeterminate state (either this FilePath has not yet had cause to call stat() yet or FilePath.changed indicated that new information is required), 0 if stat() was called and returned an error (i.e. the path did not exist when stat() was called), or a stat_result object that describes the last known status of the underlying file (or directory, as the case may be). Trust me when I tell you that you do not want to use this attribute. Instead, use the methods on FilePath which give you information about it, like getsize(), isdir(), getModificationTime(), and so on. (type: int or types.NoneType or os.stat_result)
Method __getstate__ Support serialization by discarding cached os.stat results and returning everything else.
Method child Create and return a new FilePath representing a path contained by self.
Method preauthChild Use me if `path' might have slashes in it, but you know they're safe.
Method childSearchPreauth Return my first existing child with a name in 'paths'.
Method siblingExtensionSearch Attempt to return a path with my name, given multiple possible extensions.
Method realpath No summary
Method siblingExtension Undocumented
Method linkTo No summary
Method open Open this file using mode or for writing if alwaysCreate is True.
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 changed Clear any cached information about the state of this path on disk.
Method chmod Changes the permissions on self, if possible. Propagates errors from os.chmod up.
Method getsize
Method getModificationTime Retrieve the time of last access from this file.
Method getStatusChangeTime Retrieve the time of the last status change for this file.
Method getAccessTime Retrieve the time that this file was last accessed.
Method getInodeNumber Retrieve the file serial number, also called inode number, which distinguishes this file from all other files on the same device.
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 getNumberOfHardLinks No summary
Method getUserID Returns the user ID of the file's owner.
Method getGroupID Returns the group ID of the file.
Method getPermissions Returns the permissions of the file. Should also work on Windows, however, those permissions may not what is expected in Windows.
Method exists Check if this FilePath exists.
Method isdir
Method isfile
Method isBlockDevice Returns whether the underlying path is a block device.
Method isSocket Returns whether the underlying path is a socket.
Method islink
Method isabs
Method listdir List the base names of the direct children of this FilePath.
Method splitext
Method __repr__ Undocumented
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.
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 makedirs Create all directories not yet existing in path segments, using os.makedirs.
Method globChildren Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern.
Method basename
Method dirname
Method parent
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 __cmp__ Undocumented
Method createDirectory Create the directory the FilePath refers to.
Method requireCreate Undocumented
Method create Exclusively create a file, only if this file previously did not exist.
Method temporarySibling Construct a path referring to a sibling of this path.
Method copyTo Copies self to destination.
Method moveTo No summary

Inherited from AbstractFilePath (via FilePath):

Method getContent Undocumented
Method parents
Method children List the children of this path object.
Method walk No summary
Method sibling Return a FilePath with the same directory as this instance but with a basename of path.
Method descendant Retrieve a child or child's child of this path.
Method segmentsFrom Return a list of segments between a child and its ancestor.
Method __hash__ Hash the same as another FilePath with the same path as mine.
Method getmtime Deprecated. Use getModificationTime instead.
Method getatime Deprecated. Use getAccessTime instead.
Method getctime Deprecated. Use getStatusChangeTime instead.
def __init__(self, pathname): (source)
Initialize.
def getChild(self, path, request): (source)
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.

Parameterspatha string, describing the child
requesta twisted.web.server.Request specifying meta-information about the request that is being made for this child.
def render(self, request): (source)
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 string which will be the rendered page, unless the return value is twisted.web.server.NOT_DONE_YET, in which case it is this class's responsibility to write the results to request.write(data), then call request.finish().

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

API Documentation for Twisted, generated by pydoctor at 2012-06-04 17:20:01.