From 0de1f8547dbded7e2cedc05b98a9b77490c2e2af Mon Sep 17 00:00:00 2001 From: aurel <aurel@nexedi.com> Date: Mon, 30 Aug 2021 14:27:48 +0200 Subject: [PATCH] more BBB for wsgipublisher when it is zope2 --- product/ERP5/bin/zopewsgi.py | 8 ++++++-- product/ERP5Type/patches/WSGIPublisher.py | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/product/ERP5/bin/zopewsgi.py b/product/ERP5/bin/zopewsgi.py index b7b678b07c..aaca130671 100644 --- a/product/ERP5/bin/zopewsgi.py +++ b/product/ERP5/bin/zopewsgi.py @@ -15,8 +15,12 @@ import ZConfig import Zope2 from Zope2.Startup.run import make_wsgi_app -from ZPublisher.WSGIPublisher import publish_module - +try: + from ZPublisher.WSGIPublisher import _MODULES + from ZPublisher.WSGIPublisher import publish_module +except ImportError: + # BBB Zope2 + from Products.ERP5Type.patches.WSGIPublisher import publish_module # this class licensed under the MIT license (stolen from pyramid_translogger) class TransLogger(object): diff --git a/product/ERP5Type/patches/WSGIPublisher.py b/product/ERP5Type/patches/WSGIPublisher.py index f458f316c0..bea40d1711 100644 --- a/product/ERP5Type/patches/WSGIPublisher.py +++ b/product/ERP5Type/patches/WSGIPublisher.py @@ -469,5 +469,8 @@ def publish_module(environ, start_response, # Return the result body iterable. return result - -#sys.modules['ZPublisher.WSGIPublisher'] = sys.modules[__name__] +try: + from ZPublisher.WSGIPublisher import _MODULES +except ImportError: + # BBB Zope2 + sys.modules['ZPublisher.WSGIPublisher'] = sys.modules[__name__] -- 2.30.9