t.w.v.NameVirtualHost(resource.Resource) : class documentation

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

Resource in charge of dispatching requests to other resources based on the value of the HTTP 'Host' header.
ParameterssupportNestedIf True domain segments will be chopped off until the TLD is reached or a matching virtual host is found. (In which case the child resource can do its own more specific virtual host lookup.)
Method __init__
Method addHost Add a host to this virtual host. - The Fun Stuff(TM)
Method removeHost Remove the given host. @param name: The FQDN to remove. @type name: str
Method locateChild It's a NameVirtualHost, do you know where your children are?

Inherited from Resource:

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 (via Resource):

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 __init__(self, default=None): (source)
ParametersdefaultThe default resource to be served when encountering an unknown hostname. (type: twisted.web2.iweb.IResource or None )
def addHost(self, name, resrc): (source)

Add a host to this virtual host. - The Fun Stuff(TM)

This associates a host named 'name' with a resource 'resrc':
   nvh.addHost('nevow.com', nevowDirectory)
   nvh.addHost('divmod.org', divmodDirectory)
   nvh.addHost('twistedmatrix.com', twistedMatrixDirectory)
I told you that was fun.
ParametersnameThe FQDN to be matched to the 'Host' header. (type: str )
resrcThe twisted.web2.iweb.IResource to be served as the given hostname.
resource (type: twisted.web2.iweb.IResource )
def removeHost(self, name): (source)
Remove the given host.
ParametersnameThe FQDN to remove. (type: str )
def locateChild(self, req, segments): (source)

It's a NameVirtualHost, do you know where your children are?

This uses locateChild magic so you don't have to mutate the request.
API Documentation for Twisted, generated by pydoctor at 2011-10-27 15:57:47.