From 576606a6f230bc50a82433eb60661737742c2a59 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sat, 2 Apr 2011 08:37:15 +0000 Subject: [PATCH] Advanced deprecations in core.cache. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15977 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/cache/__init__.py | 2 +- django/core/cache/backends/memcached.py | 24 +++++++++--------------- docs/internals/deprecation.txt | 6 ++++++ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py index b17ad8185a..bb10e01c65 100644 --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -80,7 +80,7 @@ if not settings.CACHES: import warnings warnings.warn( "settings.CACHE_* is deprecated; use settings.CACHES instead.", - PendingDeprecationWarning + DeprecationWarning ) else: # The default cache setting is put here so that we diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py index c456f7f3c3..6cca2f8c7c 100644 --- a/django/core/cache/backends/memcached.py +++ b/django/core/cache/backends/memcached.py @@ -126,24 +126,18 @@ class BaseMemcachedCache(BaseCache): def clear(self): self._cache.flush_all() -# For backwards compatibility -- the default cache class tries a -# cascading lookup of cmemcache, then memcache. class CacheClass(BaseMemcachedCache): def __init__(self, server, params): + warnings.warn( + "memcached.CacheClass has been split into memcached.MemcachedCache and memcached.PyLibMCCache. Please update your cache backend setting.", + PendingDeprecationWarning + ) try: - import cmemcache as memcache - import warnings - warnings.warn( - "Support for the 'cmemcache' library has been deprecated. Please use python-memcached or pyblimc instead.", - DeprecationWarning - ) - except ImportError: - try: - import memcache - except: - raise InvalidCacheBackendError( - "Memcached cache backend requires either the 'memcache' or 'cmemcache' library" - ) + import memcache + except: + raise InvalidCacheBackendError( + "Memcached cache backend requires either the 'memcache' or 'cmemcache' library" + ) super(CacheClass, self).__init__(server, params, library=memcache, value_not_found_exception=ValueError) diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 730f21d699..32f4b2d0b1 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -186,6 +186,12 @@ their deprecation, as per the :ref:`Django deprecation policy synonym for ``django.views.decorators.csrf.csrf_exempt``, which should be used to replace it. + * The :class:`~django.core.cache.backends.memcached.CacheClass` backend + was split into two in Django 1.3 in order to introduce support for + PyLibMC. The historical :class:`~django.core.cache.backends.memcached.CacheClass` + is now an alias for :class:`~django.core.cache.backends.memcached.MemcachedCache`. + In Django 1.6, the historical alias will be removed. + * 2.0 * ``django.views.defaults.shortcut()``. This function has been moved to ``django.contrib.contenttypes.views.shortcut()`` as part of the