Class t.w.r.Resource(RenderMixin):

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 Locates a child resource of this resource.
Method child_ This method locates a child with a trailing "/" in the URL.
Method putChild Register a static child.
Method http_GET Respond to a GET request.

Inherited from RenderMixin:

Method allowedMethods
Method checkPreconditions Checks all preconditions imposed by this resource upon a request made
Method renderHTTP See iweb.IResource.renderHTTP.
Method http_OPTIONS Respond to a OPTIONS request.
Method http_TRACE Respond to a TRACE request.
Method http_HEAD Respond to a HEAD request.
Method render Subclasses should implement this method to do page rendering.
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.