details:   https://code.tryton.org/tryton/commit/b3f296bc23c9
branch:    default
user:      Cédric Krier <[email protected]>
date:      Tue Aug 25 11:15:16 2026 +0200
description:
        Raise BadRequest when accessing rpc properties from non RPC request

        This avoids to generate a useless exception logging entry.

        Closes #15039
diffstat:

 trytond/trytond/protocols/wrappers.py |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 273529fe5d56 -r b3f296bc23c9 trytond/trytond/protocols/wrappers.py
--- a/trytond/trytond/protocols/wrappers.py     Thu Sep 03 12:38:02 2026 +0200
+++ b/trytond/trytond/protocols/wrappers.py     Tue Aug 25 11:15:16 2026 +0200
@@ -15,7 +15,7 @@
 
 from werkzeug import exceptions
 from werkzeug.datastructures import Authorization
-from werkzeug.exceptions import abort
+from werkzeug.exceptions import BadRequest, abort
 from werkzeug.utils import redirect, send_file
 from werkzeug.wrappers import Request as BaseRequest
 from werkzeug.wrappers import Response as BaseResponse
@@ -104,7 +104,10 @@
             args.append("'%s'" % url)
             args.append("[%s]" % self.method)
             if self.view_args:
-                args.append("%s" % (self.rpc_method or ''))
+                try:
+                    args.append("%s" % (self.rpc_method or ''))
+                except BadRequest:
+                    pass
         except Exception:
             args.append("(invalid WSGI environ)")
         return "<%s %s>" % (
@@ -126,11 +129,11 @@
 
     @property
     def rpc_method(self):
-        return
+        raise BadRequest("Not a RPC request")
 
     @property
     def rpc_params(self):
-        return
+        raise BadRequest("Not a RPC request")
 
     @cached_property
     def session(self):

Reply via email to