Reverted deprecation of media context processor (from r14293) to separate static files and media files a bit more.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14535 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2010-11-11 21:44:33 +00:00
parent 63023e6ad9
commit 70edd4e103
6 changed files with 7 additions and 25 deletions

View File

@ -194,9 +194,10 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.contrib.staticfiles.context_processors.staticfiles',
'django.core.context_processors.media',
# 'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'django.contrib.staticfiles.context_processors.staticfiles',
)
# Output to use in template system for invalid (e.g. misspelled) variables.

View File

@ -3,5 +3,4 @@ from django.conf import settings
def staticfiles(request):
return {
'STATICFILES_URL': settings.STATICFILES_URL,
'MEDIA_URL': settings.MEDIA_URL,
}

View File

@ -71,15 +71,7 @@ def media(request):
Adds media-related context variables to the context.
"""
import warnings
warnings.warn(
"The context processor at `django.core.context_processors.media` is " \
"deprecated; use the path `django.contrib.staticfiles.context_processors.staticfiles` " \
"instead.",
PendingDeprecationWarning
)
from django.contrib.staticfiles.context_processors import staticfiles as staticfiles_context_processor
return staticfiles_context_processor(request)
return {'MEDIA_URL': settings.MEDIA_URL}
def request(request):
return {'request': request}

View File

@ -154,6 +154,7 @@ editing that setting by hand it should look something like::
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.contrib.staticfiles.context_processors.staticfiles',

View File

@ -1512,12 +1512,6 @@ of items to be merged into the context.
``django.core.context_processors.auth`` to
``django.contrib.auth.context_processors.auth``.
.. versionchanged:: 1.3
``django.core.context_processors.media`` was replaced by
:func:`django.contrib.staticfiles.context_processors.staticfiles` in the
default. For more information, see the :doc:`staticfiles documentation
</ref/contrib/staticfiles>`.
.. setting:: TEMPLATE_DEBUG
TEMPLATE_DEBUG

View File

@ -311,8 +311,9 @@ and return a dictionary of items to be merged into the context. By default,
("django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.contrib.staticfiles.context_processors.staticfiles",
"django.contrib.messages.context_processors.messages")
"django.core.context_processors.media",
"django.contrib.messages.context_processors.messages",
"django.contrib.staticfiles.context_processors.staticfiles")
.. versionadded:: 1.2
In addition to these, ``RequestContext`` always uses
@ -434,12 +435,6 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
``RequestContext`` will contain a variable ``MEDIA_URL``, providing the
value of the :setting:`MEDIA_URL` setting.
.. versionchanged:: 1.3
This context processor has been moved to the new
:doc:`/ref/contrib/staticfiles` app. Please use the new
``django.contrib.staticfiles.context_processors.staticfiles``
context processor.
django.core.context_processors.csrf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~