Skip to content

Commit

Permalink
[IMP] web: add stacklevel to DeprecationWarning
Browse files Browse the repository at this point in the history
bcf665a introduced this deprecation warning without a stacklevel
argument. Adding it makes the error highlighted precisely where the
deprecated import occurred.

closes odoo#92420

X-original-commit: 9c01ab0
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Paul Morelle <pmo@odoo.com>
  • Loading branch information
madprog committed May 30, 2022
1 parent 7cf1a95 commit f7494a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/web/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __getattr__(attr):

@lazy
def only_one_warn():
warnings.warn(f"{__name__!r} has been split over multiple files, you'll find {attr!r} at {module.__name__!r}", DeprecationWarning)
warnings.warn(f"{__name__!r} has been split over multiple files, you'll find {attr!r} at {module.__name__!r}", DeprecationWarning, stacklevel=4)
return getattr(module, attr)

return only_one_warn

0 comments on commit f7494a9

Please sign in to comment.