News for hackers. Stuff that matters.
Re:A small fast and cute web framework in Python. by j2labs on Saturday May 26, 2012 @01:26PM (#4027788)
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. :)

Re:A small fast and cute web framework in Python. by doublethink on Saturday May 26, 2012 @07:20PM (#4028683)
The Play framework (java) also does this:

https://github.com/playframework/play/blob/master/framework/...

See "renderTemplate(String templateName, Map<String,Object> args)" for a good example.

Re:A small fast and cute web framework in Python. by jimhoff11 on Saturday May 26, 2012 @02:04PM (#4027902)
I noticed that too. A truly clever hack. (I mean hack in a good way.)
Re:A small fast and cute web framework in Python. by Cieplak on Saturday May 26, 2012 @02:26PM (#4027966)