Parent: [3abb2e] (diff)

Child: [875040] (diff)

Download this file

error.py    23 lines (17 with data), 677 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# -*- coding: utf-8 -*-
"""Error controller"""
from tg import request, expose
__all__ = ['ErrorController']
class ErrorController(object):
@expose('jinja:error.html')
def document(self, *args, **kwargs):
"""Render the error document"""
resp = request.environ.get('pylons.original_response')
code = -1
if resp:
code = resp.status_int
default_message = ("<p>We're sorry but we weren't able to process "
" this request.</p>")
message = request.environ.get('error_message', default_message)
message += '<pre>%r</pre>' % resp
return dict(code=code, message=message)