1
0
mirror of https://github.com/django/django.git synced 2025-07-05 18:29:11 +00:00

[soc2009/multidb] Correct the kwarg provided to warn.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11376 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2009-08-02 19:37:57 +00:00
parent 3cd611b89c
commit 3dd211ff03

View File

@ -15,14 +15,14 @@ def call_with_connection(func):
if not takes_connection: if not takes_connection:
warn("A Field class who's %s method doesn't take connection has been " warn("A Field class who's %s method doesn't take connection has been "
"defined, please add a connection argument" % func.__name__, "defined, please add a connection argument" % func.__name__,
PendingDeprecationWarning, depth=2) PendingDeprecationWarning, stacklevel=2)
def inner(*args, **kwargs): def inner(*args, **kwargs):
if 'connection' not in kwargs: if 'connection' not in kwargs:
from django.db import connection from django.db import connection
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, "
"please provide one" % func.__name__, PendingDeprecationWarning, "please provide one" % func.__name__, PendingDeprecationWarning,
depth=1) stacklevel=1)
if takes_connection: if takes_connection:
return func(*args, **kwargs) return func(*args, **kwargs)
if 'connection' in kwargs: if 'connection' in kwargs: