mirror of https://github.com/django/django.git
Change the stacklevel for Field deprecation warnings to correctly point to the source of the problem
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
dfcb814a87
commit
65b98c9b41
|
@ -15,7 +15,7 @@ def call_with_connection(func):
|
||||||
if not updated:
|
if not updated:
|
||||||
warn("A Field class whose %s method hasn't been updated to take a "
|
warn("A Field class whose %s method hasn't been updated to take a "
|
||||||
"`connection` argument." % func.__name__,
|
"`connection` argument." % func.__name__,
|
||||||
DeprecationWarning, stacklevel=2)
|
DeprecationWarning, stacklevel=3)
|
||||||
|
|
||||||
def inner(*args, **kwargs):
|
def inner(*args, **kwargs):
|
||||||
if 'connection' not in kwargs:
|
if 'connection' not in kwargs:
|
||||||
|
@ -23,7 +23,7 @@ def call_with_connection(func):
|
||||||
kwargs['connection'] = connection
|
kwargs['connection'] = connection
|
||||||
warn("%s has been called without providing a connection argument. " %
|
warn("%s has been called without providing a connection argument. " %
|
||||||
func.__name__, DeprecationWarning,
|
func.__name__, DeprecationWarning,
|
||||||
stacklevel=1)
|
stacklevel=2)
|
||||||
if updated:
|
if updated:
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
if 'connection' in kwargs:
|
if 'connection' in kwargs:
|
||||||
|
@ -40,7 +40,7 @@ def call_with_connection_and_prepared(func):
|
||||||
if not updated:
|
if not updated:
|
||||||
warn("A Field class whose %s method hasn't been updated to take "
|
warn("A Field class whose %s method hasn't been updated to take "
|
||||||
"`connection` and `prepared` arguments." % func.__name__,
|
"`connection` and `prepared` arguments." % func.__name__,
|
||||||
DeprecationWarning, stacklevel=2)
|
DeprecationWarning, stacklevel=3)
|
||||||
|
|
||||||
def inner(*args, **kwargs):
|
def inner(*args, **kwargs):
|
||||||
if 'connection' not in kwargs:
|
if 'connection' not in kwargs:
|
||||||
|
@ -48,7 +48,7 @@ def call_with_connection_and_prepared(func):
|
||||||
kwargs['connection'] = connection
|
kwargs['connection'] = connection
|
||||||
warn("%s has been called without providing a connection argument. " %
|
warn("%s has been called without providing a connection argument. " %
|
||||||
func.__name__, DeprecationWarning,
|
func.__name__, DeprecationWarning,
|
||||||
stacklevel=1)
|
stacklevel=2)
|
||||||
if updated:
|
if updated:
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
if 'connection' in kwargs:
|
if 'connection' in kwargs:
|
||||||
|
|
Loading…
Reference in New Issue