Adds a processor to the application. >>> urls = ("/(.*)", "echo") >>> app = application(urls, globals()) >>> class echo: ... def GET(self, name): return name ... >>> >>> def hello(handler): return "hell
(self, processor)
| 130 | self.mapping.append((pattern, classname)) |
| 131 | |
| 132 | def add_processor(self, processor): |
| 133 | """ |
| 134 | Adds a processor to the application. |
| 135 | |
| 136 | >>> urls = ("/(.*)", "echo") |
| 137 | >>> app = application(urls, globals()) |
| 138 | >>> class echo: |
| 139 | ... def GET(self, name): return name |
| 140 | ... |
| 141 | >>> |
| 142 | >>> def hello(handler): return "hello, " + handler() |
| 143 | ... |
| 144 | >>> app.add_processor(hello) |
| 145 | >>> app.request("/web.py").data |
| 146 | 'hello, web.py' |
| 147 | """ |
| 148 | # PY3DOCTEST: b'hello, web.py' |
| 149 | self.processors.append(processor) |
| 150 | |
| 151 | def request( |
| 152 | self, |