Commit d1051b63 authored by Jérome Perrin's avatar Jérome Perrin

zopewsgi: enable HTTPExceptionHandler

This middleware is enabled in Zope's mkwsginstance [1] and also in test,
[2], we should also enable it here for consistency.

It is necessary to handle exceptions when no standard_error_message
skin exists, like it is the case today in RJS skin selection.

1: https://github.com/zopefoundation/Zope/blob/828b1973e39f4dc1bf51fea0cd11a236d28ec3b5/src/Zope2/utilities/skel/etc/zope.ini.in#L16
2: https://github.com/zopefoundation/Zope/blob/828b1973e39f4dc1bf51fea0cd11a236d28ec3b5/src/Testing/ZopeTestCase/functional.py#L136
parent 37b3d58c
...@@ -23,9 +23,12 @@ from Zope2.Startup.run import make_wsgi_app ...@@ -23,9 +23,12 @@ from Zope2.Startup.run import make_wsgi_app
try: try:
from ZPublisher.WSGIPublisher import _MODULES from ZPublisher.WSGIPublisher import _MODULES
from ZPublisher.WSGIPublisher import publish_module from ZPublisher.WSGIPublisher import publish_module
from ZPublisher.httpexceptions import HTTPExceptionHandler
except ImportError: except ImportError:
# BBB Zope2 # BBB Zope2
from Products.ERP5Type.patches.WSGIPublisher import publish_module from Products.ERP5Type.patches.WSGIPublisher import publish_module
HTTPExceptionHandler = lambda app: app
# this class licensed under the MIT license (stolen from pyramid_translogger) # this class licensed under the MIT license (stolen from pyramid_translogger)
class TransLogger(object): class TransLogger(object):
...@@ -141,7 +144,7 @@ def app_wrapper(large_file_threshold, webdav_ports): ...@@ -141,7 +144,7 @@ def app_wrapper(large_file_threshold, webdav_ports):
environ['PATH_INFO'] = path_info environ['PATH_INFO'] = path_info
return publish_module(environ, start_response) return publish_module(environ, start_response)
return app return HTTPExceptionHandler(app)
def createServer(application, logger, **kw): def createServer(application, logger, **kw):
global server global server
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment