Browse files

Change the stacklevel for Field deprecation warnings to correctly poi…

…nt to the source of the problem

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent dfcb814 commit 65b98c9b41b3b1ba43df622e91fb561ceb16c70e @SmileyChris SmileyChris committed Oct 15, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 django/db/models/fields/subclassing.py
View
8 django/db/models/fields/subclassing.py
@@ -15,15 +15,15 @@ def call_with_connection(func):
if not updated:
warn("A Field class whose %s method hasn't been updated to take a "
"`connection` argument." % func.__name__,
- DeprecationWarning, stacklevel=2)
+ DeprecationWarning, stacklevel=3)
def inner(*args, **kwargs):
if 'connection' not in kwargs:
from django.db import connection
kwargs['connection'] = connection
warn("%s has been called without providing a connection argument. " %
func.__name__, DeprecationWarning,
- stacklevel=1)
+ stacklevel=2)
if updated:
return func(*args, **kwargs)
if 'connection' in kwargs:
@@ -40,15 +40,15 @@ def call_with_connection_and_prepared(func):
if not updated:
warn("A Field class whose %s method hasn't been updated to take "
"`connection` and `prepared` arguments." % func.__name__,
- DeprecationWarning, stacklevel=2)
+ DeprecationWarning, stacklevel=3)
def inner(*args, **kwargs):
if 'connection' not in kwargs:
from django.db import connection
kwargs['connection'] = connection
warn("%s has been called without providing a connection argument. " %
func.__name__, DeprecationWarning,
- stacklevel=1)
+ stacklevel=2)
if updated:
return func(*args, **kwargs)
if 'connection' in kwargs:

0 comments on commit 65b98c9

Please sign in to comment.