mini_buildd.httpd_twisted module¶
-
class
mini_buildd.httpd_twisted.
Site
(resource, requestFactory=None, *args, **kwargs)¶ Bases:
twisted.web.server.Site
-
class
mini_buildd.httpd_twisted.
RootResource
(wsgi_resource)¶ Bases:
twisted.web.resource.Resource
Twisted root resource needed to mix static and wsgi resources.
-
getChild
(path, request)¶ 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 L{IResource.getChildWithDefault}.
-
-
class
mini_buildd.httpd_twisted.
FileResource
(*args, with_index=False, uri_regex='.*', **kwargs)¶ Bases:
twisted.web.static.File
Twisted static resource enhanced with switchable index and regex matching support.
-
directoryListing
()¶ Return a resource that generates an HTML listing of the directory this path represents.
@return: A resource that renders the directory to HTML. @rtype: L{DirectoryLister}
-
getChild
(path, request)¶ If this L{File}”s path refers to a directory, return a L{File} referring to the file named C{path} in that directory.
If C{path} is the empty string, return a L{DirectoryLister} instead.
@param path: The current path segment. @type path: L{bytes}
@param request: The incoming request. @type request: An that provides L{twisted.web.iweb.IRequest}.
- @return: A resource representing the requested file or
- directory, or L{NoResource} if the path cannot be accessed.
@rtype: An object that provides L{resource.IResource}.
-
-
class
mini_buildd.httpd_twisted.
HttpD
(wsgi_app)¶ Bases:
mini_buildd.httpd.HttpD
-
run
()¶ Run the HTTP server. Must be implemented by backend.
-