[PATCH] Upstream patch - 13022024

This commit is contained in:
Parthiv Patel
2024-02-13 08:34:24 +00:00
parent c0e5c87b8b
commit 4b1d69fc5f
+3 -11
View File
@@ -19,7 +19,7 @@ import flectra
from flectra import api, models, registry, exceptions, tools, http
from flectra.addons.base.models.ir_http import RequestUID, ModelConverter
from flectra.addons.base.models.qweb import QWebException
from flectra.http import request
from flectra.http import request, HTTPRequest
from flectra.osv import expression
from flectra.tools import config, ustr, pycompat
@@ -530,16 +530,8 @@ class IrHttp(models.AbstractModel):
request.rerouting.append(path)
if len(request.rerouting) > cls.rerouting_limit:
raise Exception("Rerouting limit exceeded")
request.httprequest.environ['PATH_INFO'] = path
# void werkzeug cached_property. TODO: find a proper way to do this
for key in ('full_path', 'url', 'base_url'):
request.httprequest.__dict__.pop(key, None)
# since werkzeug 2.0 `path`` became an attribute and is not a cached property anymore
if hasattr(type(request.httprequest), 'path'): # cached property
request.httprequest.__dict__.pop('path', None)
else: # direct attribute
request.httprequest.path = '/' + path.lstrip('/')
environ = dict(request.httprequest._HTTPRequest__environ, PATH_INFO=path)
request.httprequest = HTTPRequest(environ)
return cls._dispatch()
@classmethod