Set stacklevel for all deprecation warnings

This commit is contained in:
Lance Edgar 2023-09-10 13:51:11 -05:00
parent 48daa042d1
commit e255c35e86
5 changed files with 9 additions and 17 deletions

View file

@ -309,7 +309,7 @@ class Grid(object):
""" """
warnings.warn("Grid.hide_column() is deprecated; please use " warnings.warn("Grid.hide_column() is deprecated; please use "
"Grid.remove() instead.", "Grid.remove() instead.",
DeprecationWarning) DeprecationWarning, stacklevel=2)
self.remove(key) self.remove(key)
def hide_columns(self, *keys): def hide_columns(self, *keys):

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar # Copyright © 2010-2023 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -24,8 +24,6 @@
(DEPRECATED) Views for handheld batches (DEPRECATED) Views for handheld batches
""" """
from __future__ import unicode_literals, absolute_import
import warnings import warnings
# nb. this is imported only for sake of legacy callers # nb. this is imported only for sake of legacy callers
@ -35,5 +33,5 @@ from tailbone.views.batch.handheld import HandheldBatchView
def includeme(config): def includeme(config):
warnings.warn("tailbone.views.handheld is a deprecated module; " warnings.warn("tailbone.views.handheld is a deprecated module; "
"please use tailbone.views.batch.handheld instead", "please use tailbone.views.batch.handheld instead",
DeprecationWarning) DeprecationWarning, stacklevel=2)
config.include('tailbone.views.batch.handheld') config.include('tailbone.views.batch.handheld')

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar # Copyright © 2010-2023 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -26,8 +26,6 @@
Please use `tailbone.views.batch.labels` instead. Please use `tailbone.views.batch.labels` instead.
""" """
from __future__ import unicode_literals, absolute_import
import warnings import warnings
@ -35,6 +33,6 @@ def includeme(config):
warnings.warn("The `tailbone.views.labels.batch` module is deprecated, " warnings.warn("The `tailbone.views.labels.batch` module is deprecated, "
"please use `tailbone.views.batch.labels` instead.", "please use `tailbone.views.batch.labels` instead.",
DeprecationWarning) DeprecationWarning, stacklevel=2)
config.include('tailbone.views.batch.labels') config.include('tailbone.views.batch.labels')

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar # Copyright © 2010-2023 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -26,13 +26,11 @@
Please use `tailbone.views.batch.vendorcatalog` instead. Please use `tailbone.views.batch.vendorcatalog` instead.
""" """
from __future__ import unicode_literals, absolute_import
import warnings import warnings
def includeme(config): def includeme(config):
warnings.warn("The `tailbone.views.vendors.catalogs` module is deprecated, " warnings.warn("The `tailbone.views.vendors.catalogs` module is deprecated, "
"please use `tailbone.views.batch.vendorcatalog` instead.", "please use `tailbone.views.batch.vendorcatalog` instead.",
DeprecationWarning) DeprecationWarning, stacklevel=2)
config.include('tailbone.views.batch.vendorcatalog') config.include('tailbone.views.batch.vendorcatalog')

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar # Copyright © 2010-2023 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -26,13 +26,11 @@
Please use `tailbone.views.batch.vendorinvoice` instead. Please use `tailbone.views.batch.vendorinvoice` instead.
""" """
from __future__ import unicode_literals, absolute_import
import warnings import warnings
def includeme(config): def includeme(config):
warnings.warn("The `tailbone.views.vendors.invoices` module is deprecated, " warnings.warn("The `tailbone.views.vendors.invoices` module is deprecated, "
"please use `tailbone.views.batch.vendorinvoice` instead.", "please use `tailbone.views.batch.vendorinvoice` instead.",
DeprecationWarning) DeprecationWarning, stacklevel=2)
config.include('tailbone.views.batch.vendorinvoice') config.include('tailbone.views.batch.vendorinvoice')