t.w.r.Resource(RenderMixin) : class documentation

Part of twisted.web2.resource View Source View In Hierarchy

Known subclasses: twisted.web2.dirlist.DirectoryLister, twisted.web2.plugin.PluginResource, twisted.web2.resource.PostableResource, twisted.web2.static.Data, twisted.web2.twcgi.CGIDirectory, twisted.web2.vhost.NameVirtualHost, twisted.web2.xmlrpc.XMLRPC

Implements interfaces: twisted.web2.iweb.IResource

An iweb.IResource implementation with some convenient mechanisms for locating children.
Method locateChild No summary
Method child_ This method locates a child with a trailing "/" in the URL. @param request: the request to process.
Method putChild Register a static child.
Method http_GET Respond to a GET request.

Inherited from RenderMixin:

Method allowedMethods
Method checkPreconditions No summary
Method renderHTTP See iweb.IResource.renderHTTP.
Method http_OPTIONS Respond to a OPTIONS request. @param request: the request to process. @return: an object adaptable to iweb.IResponse.
Method http_TRACE Respond to a TRACE request. @param request: the request to process. @return: an object adaptable to iweb.IResponse.
Method http_HEAD Respond to a HEAD request. @param request: the request to process. @return: an object adaptable to iweb.IResponse.
Method render No summary
def locateChild(self, request, segments): (source)
Locates a child resource of this resource.
Parametersrequestthe request to process.
segmentsa sequence of URL path segments.
Returnsa tuple of (child, segments) containing the child of this resource which matches one or more of the given segments in sequence, and a list of remaining segments.
def child_(self, request): (source)
This method locates a child with a trailing "/" in the URL.
Parametersrequestthe request to process.
def putChild(self, path, child): (source)

Register a static child.

This implementation registers children by assigning them to attributes with a child_ prefix. resource.putChild("foo", child) is therefore same as o.child_foo = child.
Parameterspaththe name of the child to register. You almost certainly don't want "/" in path. If you want to add a "directory" resource (e.g. /foo/) specify path as "".
childan object adaptable to iweb.IResource.
def http_GET(self, request): (source)

Respond to a GET request.

This implementation validates that the request body is empty and then dispatches the given request to render and returns its result.
Parametersrequestthe request to process.
Returnsan object adaptable to iweb.IResponse.
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:02:37.