source: web/old/error.py @ 7b63831

debianmacno-cupsweb
Last change on this file since 7b63831 was 30beeab, checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago

Remove "gutenbach-" from directory names and rename "gutenbach" to "gutenbach-server"

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[973dd91]1import os.path
2
3import paste.fileapp
4import tg
5from pylons.controllers.util import forward
6from pylons.middleware import error_document_template, media_path
7
8from sipbmp3web.lib.base import BaseController
9
10class ErrorController(object):
11    """Generates error documents as and when they are required.
12
13    The ErrorDocuments middleware forwards to ErrorController when error
14    related status codes are returned from the application.
15
16    This behaviour can be altered by changing the parameters to the
17    ErrorDocuments middleware in your config/middleware.py file.
18    """
19
20    @tg.expose('sipbmp3web.templates.error')
21    def document(self, *args, **kwargs):
22        """Render the error document"""
23        resp = tg.request.environ.get('pylons.original_response')
24        default_message = ("<p>We're sorry but we weren't able to process "
25        " this request.</p>")
26        values = dict(prefix=tg.request.environ.get('SCRIPT_NAME', ''),
27                 code=tg.request.params.get('code', resp.status_int),
28                 message=tg.request.params.get('message', default_message))
29        return values
Note: See TracBrowser for help on using the repository browser.