Show More
@@ -244,12 +244,13 b' class IPythonHandler(AuthenticatedHandler):' | |||||
244 | raise web.HTTPError(400, u'Invalid JSON in body of request') |
|
244 | raise web.HTTPError(400, u'Invalid JSON in body of request') | |
245 | return model |
|
245 | return model | |
246 |
|
246 | |||
247 |
def |
|
247 | def write_error(self, status_code, **kwargs): | |
248 | """render custom error pages""" |
|
248 | """render custom error pages""" | |
249 |
exc |
|
249 | exc_info = kwargs.get('exc_info') | |
250 | message = '' |
|
250 | message = '' | |
251 | status_message = responses.get(status_code, 'Unknown HTTP Error') |
|
251 | status_message = responses.get(status_code, 'Unknown HTTP Error') | |
252 |
if exc |
|
252 | if exc_info: | |
|
253 | exception = exc_info[1] | |||
253 | # get the custom message, if defined |
|
254 | # get the custom message, if defined | |
254 | try: |
|
255 | try: | |
255 | message = exception.log_message % exception.args |
|
256 | message = exception.log_message % exception.args | |
@@ -269,13 +270,16 b' class IPythonHandler(AuthenticatedHandler):' | |||||
269 | exception=exception, |
|
270 | exception=exception, | |
270 | ) |
|
271 | ) | |
271 |
|
272 | |||
|
273 | self.set_header('Content-Type', 'text/html') | |||
272 | # render the template |
|
274 | # render the template | |
273 | try: |
|
275 | try: | |
274 | html = self.render_template('%s.html' % status_code, **ns) |
|
276 | html = self.render_template('%s.html' % status_code, **ns) | |
275 | except TemplateNotFound: |
|
277 | except TemplateNotFound: | |
276 | self.log.debug("No template for %d", status_code) |
|
278 | self.log.debug("No template for %d", status_code) | |
277 | html = self.render_template('error.html', **ns) |
|
279 | html = self.render_template('error.html', **ns) | |
278 | return html |
|
280 | ||
|
281 | self.write(html) | |||
|
282 | ||||
279 |
|
283 | |||
280 |
|
284 | |||
281 | class Template404(IPythonHandler): |
|
285 | class Template404(IPythonHandler): |
General Comments 0
You need to be logged in to leave comments.
Login now