1
fanzeyi OP 简单看了下Tornado的代码.. 似乎可以通过重写 tornado.web.HTTPError 来实现?
|
2
Livid MOD override write_error
|
3
fanzeyi OP @Livid got it.. thanks..
其实不用重写 write_error ... 直接在 BaseHandler 中提供一个 get_error_html 函数就可以处理了 get_error_html(self, status_code, **kwargs) thanks |
4
tioover 2012-05-05 22:18:19 +08:00
|
5
Janpo 2012-05-10 10:53:19 +08:00
In Tornado 2.0 and earlier, custom error pages were implemented by overriding RequestHandler.get_error_html, which returned the error page as a string instead of calling the normal output methods (and had slightly different semantics for exceptions). This method is still supported, but it is deprecated and applications are encouraged to switch to RequestHandler.write_error
|
6
CoX 2012-05-10 11:24:40 +08:00
习惯是set_status(404),然后render的,是不是不正规呢?
|
7
fsw90628 2012-05-10 15:16:42 +08:00
@livid 这个 http://v2ex.appspot.com/ 有解决办法不?
|