Advanced deprecations in core.mail, core.commands, core.context_processors and core.handlers.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
576606a6f2
commit
af00f29ecb
|
@ -11,24 +11,6 @@ from django.conf import settings
|
||||||
from django.middleware.csrf import get_token
|
from django.middleware.csrf import get_token
|
||||||
from django.utils.functional import lazy
|
from django.utils.functional import lazy
|
||||||
|
|
||||||
def auth(request):
|
|
||||||
"""
|
|
||||||
DEPRECATED. This context processor is the old location, and has been moved
|
|
||||||
to `django.contrib.auth.context_processors`.
|
|
||||||
|
|
||||||
This function still exists for backwards-compatibility; it will be removed
|
|
||||||
in Django 1.4.
|
|
||||||
"""
|
|
||||||
import warnings
|
|
||||||
warnings.warn(
|
|
||||||
"The context processor at `django.core.context_processors.auth` is " \
|
|
||||||
"deprecated; use the path `django.contrib.auth.context_processors.auth` " \
|
|
||||||
"instead.",
|
|
||||||
DeprecationWarning
|
|
||||||
)
|
|
||||||
from django.contrib.auth.context_processors import auth as auth_context_processor
|
|
||||||
return auth_context_processor(request)
|
|
||||||
|
|
||||||
def csrf(request):
|
def csrf(request):
|
||||||
"""
|
"""
|
||||||
Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if
|
Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if
|
||||||
|
@ -97,7 +79,7 @@ class PermLookupDict(RealPermLookupDict):
|
||||||
"`django.core.context_processors.PermLookupDict` is " \
|
"`django.core.context_processors.PermLookupDict` is " \
|
||||||
"deprecated; use `django.contrib.auth.context_processors.PermLookupDict` " \
|
"deprecated; use `django.contrib.auth.context_processors.PermLookupDict` " \
|
||||||
"instead.",
|
"instead.",
|
||||||
PendingDeprecationWarning
|
DeprecationWarning
|
||||||
)
|
)
|
||||||
super(PermLookupDict, self).__init__(*args, **kwargs)
|
super(PermLookupDict, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -108,6 +90,6 @@ class PermWrapper(RealPermWrapper):
|
||||||
"`django.core.context_processors.PermWrapper` is " \
|
"`django.core.context_processors.PermWrapper` is " \
|
||||||
"deprecated; use `django.contrib.auth.context_processors.PermWrapper` " \
|
"deprecated; use `django.contrib.auth.context_processors.PermWrapper` " \
|
||||||
"instead.",
|
"instead.",
|
||||||
PendingDeprecationWarning
|
DeprecationWarning
|
||||||
)
|
)
|
||||||
super(PermWrapper, self).__init__(*args, **kwargs)
|
super(PermWrapper, self).__init__(*args, **kwargs)
|
||||||
|
|
|
@ -160,7 +160,7 @@ class ModPythonHandler(BaseHandler):
|
||||||
|
|
||||||
def __call__(self, req):
|
def __call__(self, req):
|
||||||
warn(('The mod_python handler is deprecated; use a WSGI or FastCGI server instead.'),
|
warn(('The mod_python handler is deprecated; use a WSGI or FastCGI server instead.'),
|
||||||
PendingDeprecationWarning)
|
DeprecationWarning)
|
||||||
|
|
||||||
# mod_python fakes the environ, and thus doesn't process SetEnv. This fixes that
|
# mod_python fakes the environ, and thus doesn't process SetEnv. This fixes that
|
||||||
os.environ.update(req.subprocess_env)
|
os.environ.update(req.subprocess_env)
|
||||||
|
|
|
@ -107,13 +107,3 @@ def mail_managers(subject, message, fail_silently=False, connection=None,
|
||||||
if html_message:
|
if html_message:
|
||||||
mail.attach_alternative(html_message, 'text/html')
|
mail.attach_alternative(html_message, 'text/html')
|
||||||
mail.send(fail_silently=fail_silently)
|
mail.send(fail_silently=fail_silently)
|
||||||
|
|
||||||
|
|
||||||
class SMTPConnection(_SMTPConnection):
|
|
||||||
def __init__(self, *args, **kwds):
|
|
||||||
import warnings
|
|
||||||
warnings.warn(
|
|
||||||
'mail.SMTPConnection is deprecated; use mail.get_connection() instead.',
|
|
||||||
DeprecationWarning
|
|
||||||
)
|
|
||||||
super(SMTPConnection, self).__init__(*args, **kwds)
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Command(AppCommand):
|
||||||
import warnings
|
import warnings
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
'This command has been deprecated. The command ``flush`` can be used to delete everything. You can also use ALTER TABLE or DROP TABLE statements manually.',
|
'This command has been deprecated. The command ``flush`` can be used to delete everything. You can also use ALTER TABLE or DROP TABLE statements manually.',
|
||||||
PendingDeprecationWarning
|
DeprecationWarning
|
||||||
)
|
)
|
||||||
using = options.get('database', DEFAULT_DB_ALIAS)
|
using = options.get('database', DEFAULT_DB_ALIAS)
|
||||||
connection = connections[using]
|
connection = connections[using]
|
||||||
|
|
|
@ -23,18 +23,8 @@ class Command(BaseCommand):
|
||||||
failfast = options.get('failfast', False)
|
failfast = options.get('failfast', False)
|
||||||
TestRunner = get_runner(settings)
|
TestRunner = get_runner(settings)
|
||||||
|
|
||||||
if hasattr(TestRunner, 'func_name'):
|
test_runner = TestRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)
|
||||||
# Pre 1.2 test runners were just functions,
|
failures = test_runner.run_tests(test_labels)
|
||||||
# and did not support the 'failfast' option.
|
|
||||||
import warnings
|
|
||||||
warnings.warn(
|
|
||||||
'Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.',
|
|
||||||
DeprecationWarning
|
|
||||||
)
|
|
||||||
failures = TestRunner(test_labels, verbosity=verbosity, interactive=interactive)
|
|
||||||
else:
|
|
||||||
test_runner = TestRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)
|
|
||||||
failures = test_runner.run_tests(test_labels)
|
|
||||||
|
|
||||||
if failures:
|
if failures:
|
||||||
sys.exit(bool(failures))
|
sys.exit(bool(failures))
|
||||||
|
|
|
@ -102,7 +102,7 @@ def sql_reset(app, style, connection):
|
||||||
import warnings
|
import warnings
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
'This command has been deprecated. The command ``sqlflush`` can be used to delete everything. You can also use ALTER TABLE or DROP TABLE statements manually.',
|
'This command has been deprecated. The command ``sqlflush`` can be used to delete everything. You can also use ALTER TABLE or DROP TABLE statements manually.',
|
||||||
PendingDeprecationWarning
|
DeprecationWarning
|
||||||
)
|
)
|
||||||
return sql_delete(app, style, connection) + sql_all(app, style, connection)
|
return sql_delete(app, style, connection) + sql_all(app, style, connection)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue