From: Zhicheng Wei Date: Mon, 22 Feb 2016 08:02:01 +0000 (+0800) Subject: render() should raise an error when finish() already called X-Git-Tag: v4.4.0b1~36^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1648%2Fhead;p=thirdparty%2Ftornado.git render() should raise an error when finish() already called --- diff --git a/tornado/web.py b/tornado/web.py index 8826c62b0..d1cb7391a 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -696,6 +696,8 @@ class RequestHandler(object): def render(self, template_name, **kwargs): """Renders the template with the given arguments as the response.""" + if self._finished: + raise RuntimeError("Cannot render() after finish()") html = self.render_string(template_name, **kwargs) # Insert the additional JS and CSS added by the modules on the page