web.web.application'.subdomain_application

Package web :: Package web :: Module application' :: Class subdomain_application |
[hide private]
[frames] | no frames]

# Class subdomain_application

source code

    application --+
                  |
                 subdomain_application

Application to delegate requests based on the host.

    >>> urls = ("/hello", "hello")
    >>> app = application(urls, globals())
    >>> class hello:
    ...     def GET(self): return "hello"
    >>>
    >>> mapping = (r"hello\.example\.com", app)
    >>> app2 = subdomain_application(mapping)
    >>> app2.request("/hello", host="hello.example.com").data
    'hello'
    >>> response = app2.request("/hello", host="something.example.com")
    >>> response.status
    '404 Not Found'
    >>> response.data
    'not found'

Instance Methods | [hide private]
_match(self, mapping, value) | source code
handle(self) | source code
Inherited from `application`: `__init__`, `add_mapping`, `add_processor`, `browser`, `cgirun`, `get_parent_app`, `handle_with_processors`, `internalerror`, `load`, `notfound`, `request`, `run`, `wsgifunc` Inherited from `application` (private): `_cleanup`, `_delegate`, `_delegate_sub_application`, `_load`, `_unload`

Method Details | [hide private]

### _match(self, mapping, value) | source code
Overrides: application._match

### handle(self) | source code
Overrides: application.handle