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

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

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

Implements interfaces: twisted.web2.iweb.IResource

An iweb.IResource implementation with some convenient mechanisms for locating children.
Line # Kind Name Docs
148 Method locateChild Locates a child resource of this resource.
173 Method child_ This method locates a child with a trailing "/" in the URL.
182 Method putChild Register a static child.
197 Method http_GET Respond to a GET request.

Inherited from RenderMixin:

Line # Kind Name Docs
19 Method allowedMethods
27 Method checkPreconditions Checks all preconditions imposed by this resource upon a request made
53 Method renderHTTP See iweb.IResource.renderHTTP.
89 Method http_OPTIONS Respond to a OPTIONS request.
99 Method http_TRACE Respond to a TRACE request.
107 Method http_HEAD Respond to a HEAD request.
130 Method render Subclasses should implement this method to do page rendering.
def locateChild(self, request, segments):
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):
This method locates a child with a trailing "/" in the URL.
Parametersrequestthe request to process.
def putChild(self, path, child):

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):

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.