Skip to content

Commit

Permalink
[FIX] sentry: Fix KeyError 'with_locals' on DEFAULT_OPTIONS
Browse files Browse the repository at this point in the history
See original migration for reference: getsentry/sentry-python@888c0e1
  • Loading branch information
hnavarro-kernet committed Feb 2, 2025
1 parent 2ffe4e9 commit ab590bc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sentry/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ configuration file:
Other `client arguments
<https://docs.sentry.io/platforms/python/configuration/>`_ 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,
Expand Down
2 changes: 1 addition & 1 deletion sentry/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ 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
),
Expand Down
5 changes: 5 additions & 0 deletions sentry/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sentry/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ configuration file:
Other `client arguments
<https://docs.sentry.io/platforms/python/configuration/>`_ 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,
Expand Down
2 changes: 1 addition & 1 deletion sentry/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
</table>
<p>Other <a class="reference external" href="https://docs.sentry.io/platforms/python/configuration/">client arguments</a> can be
configured by prepending the argument name with <em>sentry_</em> in your Odoo config
file. Currently supported additional client arguments are: <tt class="docutils literal">with_locals,
file. Currently supported additional client arguments are: <tt class="docutils literal">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,
Expand Down

0 comments on commit ab590bc

Please sign in to comment.