From b077ba7ac1af3fb6557d9d32dc08cf6da07cc73d Mon Sep 17 00:00:00 2001 From: Chris Beaven Date: Thu, 27 Mar 2014 15:43:31 +1300 Subject: [PATCH] Add a useful stacklevel to some RemovedInDjango19Warnings --- django/contrib/gis/db/backends/util.py | 3 ++- django/db/backends/util.py | 3 ++- django/forms/util.py | 2 +- django/utils/tzinfo.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/django/contrib/gis/db/backends/util.py b/django/contrib/gis/db/backends/util.py index 6be5bc256e..08f1ca8d80 100644 --- a/django/contrib/gis/db/backends/util.py +++ b/django/contrib/gis/db/backends/util.py @@ -4,6 +4,7 @@ from django.utils.deprecation import RemovedInDjango19Warning warnings.warn( "The django.contrib.gis.db.backends.util module has been renamed. " - "Use django.contrib.gis.db.backends.utils instead.", RemovedInDjango19Warning) + "Use django.contrib.gis.db.backends.utils instead.", + RemovedInDjango19Warning, stacklevel=2) from django.contrib.gis.db.backends.utils import * # NOQA diff --git a/django/db/backends/util.py b/django/db/backends/util.py index ef5e8acc15..5797830974 100644 --- a/django/db/backends/util.py +++ b/django/db/backends/util.py @@ -4,6 +4,7 @@ from django.utils.deprecation import RemovedInDjango19Warning warnings.warn( "The django.db.backends.util module has been renamed. " - "Use django.db.backends.utils instead.", RemovedInDjango19Warning) + "Use django.db.backends.utils instead.", RemovedInDjango19Warning, + stacklevel=2) from django.db.backends.utils import * # NOQA diff --git a/django/forms/util.py b/django/forms/util.py index 42d521105e..e093068275 100644 --- a/django/forms/util.py +++ b/django/forms/util.py @@ -4,6 +4,6 @@ from django.utils.deprecation import RemovedInDjango19Warning warnings.warn( "The django.forms.util module has been renamed. " - "Use django.forms.utils instead.", RemovedInDjango19Warning) + "Use django.forms.utils instead.", RemovedInDjango19Warning, stacklevel=2) from django.forms.utils import * # NOQA diff --git a/django/utils/tzinfo.py b/django/utils/tzinfo.py index 973a27a313..25efd20222 100644 --- a/django/utils/tzinfo.py +++ b/django/utils/tzinfo.py @@ -12,7 +12,7 @@ from django.utils.encoding import force_str, force_text, DEFAULT_LOCALE_ENCODING warnings.warn( "django.utils.tzinfo will be removed in Django 1.9. " "Use django.utils.timezone instead.", - RemovedInDjango19Warning) + RemovedInDjango19Warning, stacklevel=2) # Python's doc say: "A tzinfo subclass must have an __init__() method that can