Package circuits :: Package web :: Module dispatchers :: Class VirtualHosts

Class VirtualHosts

    object --+            
             |            
  core.Manager --+        
                 |        
core.BaseComponent --+    
                     |    
        core.Component --+
                         |
                        VirtualHosts

Forward to anotehr Dispatcher based on the Host header.

This can be useful when running multiple sites within one server. It allows several domains to point to different parts of a single website structure. For example:

Nested Classes

Inherited from core.Component: __metaclass__

Instance Methods
 
__init__(self, domains)
initializes x; see x.__class__.__doc__ for signature
 
request(self, event, request, response)

Inherited from core.BaseComponent: __repr__, register, unregister

Inherited from core.Manager: __add__, __iadd__, __isub__, __len__, __sub__, flush, join, push, run, send, start, stop

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods

Inherited from core.Component: __new__

Class Variables
  channel = 'web'
The Component's Channel
Instance Variables

Inherited from core.Manager: manager

Properties

Inherited from core.Manager: name, running, state

Inherited from object: __class__

Method Details

__init__(self, domains)
(Constructor)

 

initializes x; see x.__class__.__doc__ for signature

Parameters:
  • domains (dict

    The incoming "Host" request header is looked up in this dict, and, if a match is found, the corresponding "virtual prefix" value will be prepended to the URL path before passing the request onto the next dispatcher.

    Note that you often need separate entries for "example.com" and "www.example.com". In addition, "Host" headers may contain the port number.

    ) - a dict of {host header value: virtual prefix} pairs.
Overrides: object.__init__
(inherited documentation)

request(self, event, request, response)

 
Decorators:
  • @handler("request", filter= True, priority= 10)