From 11fa2a5b2761c763f110b066110eb55f78a467da Mon Sep 17 00:00:00 2001 From: Hodei Navarro Date: Mon, 3 Feb 2025 12:07:06 +0100 Subject: [PATCH] [FIX] sentry: Fix KeyError 'with_locals' on DEFAULT_OPTIONS See original migration for reference: getsentry/sentry-python@888c0e1 --- sentry/README.rst | 2 +- sentry/const.py | 4 +++- sentry/hooks.py | 5 +++++ sentry/readme/CONFIGURE.rst | 2 +- sentry/static/description/index.html | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sentry/README.rst b/sentry/README.rst index fc7c2a894ef..2c2bbd109d1 100644 --- a/sentry/README.rst +++ b/sentry/README.rst @@ -103,7 +103,7 @@ configuration file: Other `client arguments `_ can be configured by prepending the argument name with *sentry_* in your Odoo config -file. Currently supported additional client arguments are: ``with_locals, +file. Currently supported additional client arguments are: ``include_local_variables, max_breadcrumbs, release, environment, server_name, shutdown_timeout, in_app_include, in_app_exclude, default_integrations, dist, sample_rate, send_default_pii, http_proxy, https_proxy, request_bodies, debug, diff --git a/sentry/const.py b/sentry/const.py index 78b783bddf8..c674044a2ad 100644 --- a/sentry/const.py +++ b/sentry/const.py @@ -81,7 +81,9 @@ def get_sentry_options(): SentryOption("dsn", "", str.strip), SentryOption("transport", DEFAULT_OPTIONS["transport"], select_transport), SentryOption("logging_level", DEFAULT_LOG_LEVEL, get_sentry_logging), - SentryOption("with_locals", DEFAULT_OPTIONS["with_locals"], None), + SentryOption( + "include_local_variables", DEFAULT_OPTIONS["include_local_variables"], None + ), SentryOption( "max_breadcrumbs", DEFAULT_OPTIONS["max_breadcrumbs"], to_int_if_defined ), diff --git a/sentry/hooks.py b/sentry/hooks.py index 2236977c358..189b83d13b8 100644 --- a/sentry/hooks.py +++ b/sentry/hooks.py @@ -97,6 +97,11 @@ def initialize_sentry(config): "Its not neccesary send it, will use `HttpTranport` by default.", DeprecationWarning, ) + if config.get("sentry_with_locals"): + warnings.warn( + "`with_locals` has been deprecated. " + "Use `include_local_variables` instead." + ) options = {} for option in const.get_sentry_options(): value = config.get("sentry_%s" % option.key, option.default) diff --git a/sentry/readme/CONFIGURE.rst b/sentry/readme/CONFIGURE.rst index 25de942df51..e858744f7e4 100644 --- a/sentry/readme/CONFIGURE.rst +++ b/sentry/readme/CONFIGURE.rst @@ -48,7 +48,7 @@ configuration file: Other `client arguments `_ can be configured by prepending the argument name with *sentry_* in your Odoo config -file. Currently supported additional client arguments are: ``with_locals, +file. Currently supported additional client arguments are: ``include_local_variables, max_breadcrumbs, release, environment, server_name, shutdown_timeout, in_app_include, in_app_exclude, default_integrations, dist, sample_rate, send_default_pii, http_proxy, https_proxy, request_bodies, debug, diff --git a/sentry/static/description/index.html b/sentry/static/description/index.html index 1d8f03a944b..c51792e5b94 100644 --- a/sentry/static/description/index.html +++ b/sentry/static/description/index.html @@ -484,7 +484,7 @@

Configuration

Other client arguments can be configured by prepending the argument name with sentry_ in your Odoo config -file. Currently supported additional client arguments are: with_locals, +file. Currently supported additional client arguments are: include_local_variables, max_breadcrumbs, release, environment, server_name, shutdown_timeout, in_app_include, in_app_exclude, default_integrations, dist, sample_rate, send_default_pii, http_proxy, https_proxy, request_bodies, debug,