Appends the given handlers to our handler list. Host patterns are processed sequentially in the order they were added. All matching patterns will be considered.
(self, host_pattern: str, host_handlers: _RuleList)
| 2142 | return server |
| 2143 | |
| 2144 | def add_handlers(self, host_pattern: str, host_handlers: _RuleList) -> None: |
| 2145 | """Appends the given handlers to our handler list. |
| 2146 | |
| 2147 | Host patterns are processed sequentially in the order they were |
| 2148 | added. All matching patterns will be considered. |
| 2149 | """ |
| 2150 | host_matcher = HostMatches(host_pattern) |
| 2151 | rule = Rule(host_matcher, _ApplicationRouter(self, host_handlers)) |
| 2152 | |
| 2153 | self.default_router.rules.insert(-1, rule) |
| 2154 | |
| 2155 | if self.default_host is not None: |
| 2156 | self.wildcard_router.add_rules( |
| 2157 | [(DefaultHostMatches(self, host_matcher.host_pattern), host_handlers)] |
| 2158 | ) |
| 2159 | |
| 2160 | def add_transform(self, transform_class: Type["OutputTransform"]) -> None: |
| 2161 | self.transforms.append(transform_class) |