[Mpuls-commits] r1640 - in wasko/branches/2.0: . mpulsweb/controllers mpulsweb/templates mpulsweb/templates/error
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Feb 16 17:51:06 CET 2010
Author: torsten
Date: 2010-02-16 17:51:05 +0100 (Tue, 16 Feb 2010)
New Revision: 1640
Added:
wasko/branches/2.0/mpulsweb/templates/error/
wasko/branches/2.0/mpulsweb/templates/error/error.mako
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/mpulsweb/controllers/error.py
Log:
* mpulsweb/controllers/error.py,
mpulsweb/templates/error,
mpulsweb/templates/error/error.mako: Display custom error page in
production mode.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-02-16 16:35:00 UTC (rev 1639)
+++ wasko/branches/2.0/ChangeLog 2010-02-16 16:51:05 UTC (rev 1640)
@@ -164,6 +164,11 @@
* waskaweb/tests/functional/test_CaseBase.py,
waskaweb/controllers/CaseBase.py: Deleted. Not used anymore.
+ * mpulsweb/controllers/error.py,
+ mpulsweb/templates/error,
+ mpulsweb/templates/error/error.mako: Display custom error page in
+ production mode.
+
2010-02-15 Bernhard Herzog <bh at intevation.de>
* waskaweb/controllers/evaluate.py: The base package is called
Modified: wasko/branches/2.0/mpulsweb/controllers/error.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/error.py 2010-02-16 16:35:00 UTC (rev 1639)
+++ wasko/branches/2.0/mpulsweb/controllers/error.py 2010-02-16 16:51:05 UTC (rev 1640)
@@ -1,12 +1,12 @@
import cgi
from paste.urlparser import PkgResourcesParser
-from pylons import request
+from pylons import request, config
from pylons.controllers.util import forward
from pylons.middleware import error_document_template
from webhelpers.html.builder import literal
-from mpulsweb.lib.base import BaseController
+from mpulsweb.lib.base import BaseController, render, c
class ErrorController(BaseController):
@@ -23,12 +23,10 @@
def document(self):
"""Render the error document"""
resp = request.environ.get('pylons.original_response')
- content = literal(resp.body) or cgi.escape(request.GET.get('message', ''))
- page = error_document_template % \
- dict(prefix=request.environ.get('SCRIPT_NAME', ''),
- code=cgi.escape(request.GET.get('code', str(resp.status_int))),
- message=content)
- return page
+ c.error_code = cgi.escape(request.GET.get('code', str(resp.status_int)))
+ c.error_message = literal(resp.body) or cgi.escape(request.GET.get('message', ''))
+ c.error_email = config.get('email_to', 'mpuls at intevation.de')
+ return render('/error/error.mako')
def img(self, id):
"""Serve Pylons' stock images"""
Added: wasko/branches/2.0/mpulsweb/templates/error/error.mako
===================================================================
--- wasko/branches/2.0/mpulsweb/templates/error/error.mako 2010-02-16 16:35:00 UTC (rev 1639)
+++ wasko/branches/2.0/mpulsweb/templates/error/error.mako 2010-02-16 16:51:05 UTC (rev 1640)
@@ -0,0 +1,8 @@
+## -*- coding: utf-8 -*-
+<%inherit file="../auth/main.mako" />
+<h1>${_('%s Fehler %s') % (h.get_app_title(), c.error_code)}</h1>
+<p>
+ Bei der letzten Anfrage ist ein unerwarteter Fehler aufgetreten.<br>
+ Sollte dieser Fehler wiederholt auftreten, wenden sie sich bitte an
+ <a href="mailto:${c.error_email}">${c.error_email}</a>.
+</p>
More information about the Mpuls-commits
mailing list