Show More
@@ -235,12 +235,13 b' class IPythonHandler(AuthenticatedHandler):' | |||||
235 | raise web.HTTPError(400, u'Invalid JSON in body of request') |
|
235 | raise web.HTTPError(400, u'Invalid JSON in body of request') | |
236 | return model |
|
236 | return model | |
237 |
|
237 | |||
238 |
def |
|
238 | def write_error(self, status_code, **kwargs): | |
239 | """render custom error pages""" |
|
239 | """render custom error pages""" | |
240 |
exc |
|
240 | exc_info = kwargs.get('exc_info') | |
241 | message = '' |
|
241 | message = '' | |
242 | status_message = responses.get(status_code, 'Unknown HTTP Error') |
|
242 | status_message = responses.get(status_code, 'Unknown HTTP Error') | |
243 |
if exc |
|
243 | if exc_info: | |
|
244 | exception = exc_info[1] | |||
244 | # get the custom message, if defined |
|
245 | # get the custom message, if defined | |
245 | try: |
|
246 | try: | |
246 | message = exception.log_message % exception.args |
|
247 | message = exception.log_message % exception.args | |
@@ -260,13 +261,16 b' class IPythonHandler(AuthenticatedHandler):' | |||||
260 | exception=exception, |
|
261 | exception=exception, | |
261 | ) |
|
262 | ) | |
262 |
|
263 | |||
|
264 | self.set_header('Content-Type', 'text/html') | |||
263 | # render the template |
|
265 | # render the template | |
264 | try: |
|
266 | try: | |
265 | html = self.render_template('%s.html' % status_code, **ns) |
|
267 | html = self.render_template('%s.html' % status_code, **ns) | |
266 | except TemplateNotFound: |
|
268 | except TemplateNotFound: | |
267 | self.log.debug("No template for %d", status_code) |
|
269 | self.log.debug("No template for %d", status_code) | |
268 | html = self.render_template('error.html', **ns) |
|
270 | html = self.render_template('error.html', **ns) | |
269 | return html |
|
271 | ||
|
272 | self.write(html) | |||
|
273 | ||||
270 |
|
274 | |||
271 |
|
275 | |||
272 | class Template404(IPythonHandler): |
|
276 | class Template404(IPythonHandler): |
General Comments 0
You need to be logged in to leave comments.
Login now