From 70edd4e103832dc95c42643365d1d676c6d5ded6 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 11 Nov 2010 21:44:33 +0000 Subject: [PATCH] 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 --- django/conf/global_settings.py | 3 ++- django/contrib/staticfiles/context_processors.py | 1 - django/core/context_processors.py | 10 +--------- docs/howto/static-files.txt | 1 + docs/ref/settings.txt | 6 ------ docs/ref/templates/api.txt | 11 +++-------- 6 files changed, 7 insertions(+), 25 deletions(-) diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 6ca07042574..d31e61f88d0 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -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. diff --git a/django/contrib/staticfiles/context_processors.py b/django/contrib/staticfiles/context_processors.py index e1c8d8c8ed4..3ed00719e12 100644 --- a/django/contrib/staticfiles/context_processors.py +++ b/django/contrib/staticfiles/context_processors.py @@ -3,5 +3,4 @@ from django.conf import settings def staticfiles(request): return { 'STATICFILES_URL': settings.STATICFILES_URL, - 'MEDIA_URL': settings.MEDIA_URL, } diff --git a/django/core/context_processors.py b/django/core/context_processors.py index a529c612aa3..7a59728bfcf 100644 --- a/django/core/context_processors.py +++ b/django/core/context_processors.py @@ -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} diff --git a/docs/howto/static-files.txt b/docs/howto/static-files.txt index 8dca80eb84d..37f1fc361db 100644 --- a/docs/howto/static-files.txt +++ b/docs/howto/static-files.txt @@ -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', diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 2c338df6c7d..66c6e264af4 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -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 - `. - .. setting:: TEMPLATE_DEBUG TEMPLATE_DEBUG diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt index 4bb61b80b73..aa4951eebe7 100644 --- a/docs/ref/templates/api.txt +++ b/docs/ref/templates/api.txt @@ -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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~