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