Converts a load hook into an application processor. >>> app = auto_application() >>> def f(): "something done before handling request" ... >>> app.add_processor(loadhook(f))
(h)
| 664 | |
| 665 | |
| 666 | def loadhook(h): |
| 667 | """ |
| 668 | Converts a load hook into an application processor. |
| 669 | |
| 670 | >>> app = auto_application() |
| 671 | >>> def f(): "something done before handling request" |
| 672 | ... |
| 673 | >>> app.add_processor(loadhook(f)) |
| 674 | """ |
| 675 | |
| 676 | def processor(handler): |
| 677 | h() |
| 678 | return handler() |
| 679 | |
| 680 | return processor |
| 681 | |
| 682 | |
| 683 | def unloadhook(h): |