3 ms·
People interested in frameworks should read bottle's code. It has a neat feature where the request handling is built by sub classing exceptions. This allows req
by j2labs 14y ago
People interested in frameworks should read bottle's code. It has a neat feature where the request handling is built by sub classing exceptions. This allows request processing to terminate at any point by simply raising the handler. There is a global try/except that then renders the result.
This mechanism is quite good for ensuring every request proper gets a response, though it also allows dodgy exception handling to interfere with processing. A discussion on the merits of exceptions themselves is beyond the scope of this comment. :)
- jimhoff11 14y agoI noticed that too. A truly clever hack. (I mean hack in a good way.)
- Cieplak 14y agohttps://github.com/defnull/bottle https://github.com/defnull/bottle
- doublethink 14y agoThe Play framework (java) also does this: https://github.com/playframework/play/blob/master/framework/src/play/mvc/Controller.java https://github.com/playframework/play/blob/master/framework/... See "renderTemplate(String templateName, Map<String,Object> args)" for a good example.