allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [allura] 11/12: [#8273] make nice 500 pages show again, when debug=false
Date Tue, 09 Apr 2019 17:02:46 GMT
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit a366cbf77c929d9a7e3360bd4b617996757ec32f
Author: Dave Brondsema <dave@brondsema.net>
AuthorDate: Wed Apr 3 17:44:08 2019 -0400

    [#8273] make nice 500 pages show again, when debug=false
---
 Allura/allura/config/middleware.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index 21e78b4..7775d6e 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -27,8 +27,9 @@ from tg import config
 from paste.deploy.converters import asbool, aslist, asint
 from tg.support.registry import RegistryManager
 from routes.middleware import RoutesMiddleware
-from pylons.middleware import StatusCodeRedirect
+from tg.support.middlewares import StatusCodeRedirect
 from beaker.middleware import SessionMiddleware
+from weberror.errormiddleware import ErrorMiddleware
 
 import activitystream
 import ew
@@ -170,10 +171,13 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
 
     # "task" wsgi would get a 2nd request to /error/document if we used this middleware
     if config.get('override_root') not in ('task', 'basetest_project_root'):
-        # Converts exceptions to HTTP errors, shows traceback in debug mode
-        # don't use TG footer with extra CSS & images that take time to load
-        tg.error.footer_html = '<!-- %s %s -->'
-        app = tg.error.ErrorHandler(app, global_conf, **config['tg.errorware'])
+        if asbool(config['debug']):
+            # Converts exceptions to HTTP errors, shows traceback in debug mode
+            # don't use TG footer with extra CSS & images that take time to load
+            tg.error.footer_html = '<!-- %s %s -->'
+            app = tg.error.ErrorHandler(app, global_conf, **config['tg.errorware'])
+        else:
+            app = ErrorMiddleware(app, config, **config['tg.errorware'])
 
         app = SetRequestHostFromConfig(app, config)
 


Mime
View raw message