trytond/fix_werkzeug.patch
Axel Braun 9876e5e7ff Accepting request 781490 from home:mimi_vx:branches:Application:ERP:GNUHealth:Factory
- add fix_werkzeug.patch to fix boo#1164970
- remove implicit _service (not needed anymore for download)
- spec-clean to meet openSUSE packaging standards

OBS-URL: https://build.opensuse.org/request/show/781490
OBS-URL: https://build.opensuse.org/package/show/Application:ERP:GNUHealth:Factory/trytond?expand=0&rev=83
2020-03-04 15:38:05 +00:00

35 lines
1.3 KiB
Diff

Index: trytond-5.0.18/trytond/wsgi.py
===================================================================
--- trytond-5.0.18.orig/trytond/wsgi.py
+++ trytond-5.0.18/trytond/wsgi.py
@@ -9,8 +9,19 @@ import traceback
from werkzeug.wrappers import Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import abort, HTTPException, InternalServerError
-from werkzeug.contrib.fixers import ProxyFix
-from werkzeug.wsgi import SharedDataMiddleware
+try:
+ from werkzeug.middleware.proxy_fix import ProxyFix
+
+ def NumProxyFix(app, num_proxies):
+ return ProxyFix(app,
+ x_for=num_proxies, x_proto=num_proxies, x_host=num_proxies,
+ x_port=num_proxies, x_prefix=num_proxies)
+except ImportError:
+ from werkzeug.contrib.fixers import ProxyFix as NumProxyFix
+try:
+ from werkzeug.middleware.shared_data import SharedDataMiddleware
+except ImportError:
+ from werkzeug.wsgi import SharedDataMiddleware
import wrapt
@@ -150,6 +161,6 @@ if config.get('web', 'root'):
app.wsgi_app = SharedDataMiddlewareIndex(app.wsgi_app, static_files)
num_proxies = config.getint('web', 'num_proxies')
if num_proxies:
- app.wsgi_app = ProxyFix(app.wsgi_app, num_proxies=num_proxies)
+ app.wsgi_app = NumProxyFix(app.wsgi_app, num_proxies)
import trytond.protocols.dispatcher
import trytond.bus