debianmacno-cupsweb
|
Last change
on this file since 4b9d354 was
973dd91,
checked in by Edward Z. Yang <edwardzyang@…>, 17 years ago
|
|
Initial commit.
Signed-off-by: Edward Z. Yang <edwardzyang@…>
|
-
Property mode set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | import os.path |
|---|
| 2 | |
|---|
| 3 | import paste.fileapp |
|---|
| 4 | import tg |
|---|
| 5 | from pylons.controllers.util import forward |
|---|
| 6 | from pylons.middleware import error_document_template, media_path |
|---|
| 7 | |
|---|
| 8 | from sipbmp3web.lib.base import BaseController |
|---|
| 9 | |
|---|
| 10 | class 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.