Advanced deprecations in core.cache.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
24b7d9017d
commit
576606a6f2
|
@ -80,7 +80,7 @@ if not settings.CACHES:
|
||||||
import warnings
|
import warnings
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"settings.CACHE_* is deprecated; use settings.CACHES instead.",
|
"settings.CACHE_* is deprecated; use settings.CACHES instead.",
|
||||||
PendingDeprecationWarning
|
DeprecationWarning
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# The default cache setting is put here so that we
|
# The default cache setting is put here so that we
|
||||||
|
|
|
@ -126,24 +126,18 @@ class BaseMemcachedCache(BaseCache):
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self._cache.flush_all()
|
self._cache.flush_all()
|
||||||
|
|
||||||
# For backwards compatibility -- the default cache class tries a
|
|
||||||
# cascading lookup of cmemcache, then memcache.
|
|
||||||
class CacheClass(BaseMemcachedCache):
|
class CacheClass(BaseMemcachedCache):
|
||||||
def __init__(self, server, params):
|
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:
|
try:
|
||||||
import cmemcache as memcache
|
import memcache
|
||||||
import warnings
|
except:
|
||||||
warnings.warn(
|
raise InvalidCacheBackendError(
|
||||||
"Support for the 'cmemcache' library has been deprecated. Please use python-memcached or pyblimc instead.",
|
"Memcached cache backend requires either the 'memcache' or 'cmemcache' library"
|
||||||
DeprecationWarning
|
)
|
||||||
)
|
|
||||||
except ImportError:
|
|
||||||
try:
|
|
||||||
import memcache
|
|
||||||
except:
|
|
||||||
raise InvalidCacheBackendError(
|
|
||||||
"Memcached cache backend requires either the 'memcache' or 'cmemcache' library"
|
|
||||||
)
|
|
||||||
super(CacheClass, self).__init__(server, params,
|
super(CacheClass, self).__init__(server, params,
|
||||||
library=memcache,
|
library=memcache,
|
||||||
value_not_found_exception=ValueError)
|
value_not_found_exception=ValueError)
|
||||||
|
|
|
@ -186,6 +186,12 @@ their deprecation, as per the :ref:`Django deprecation policy
|
||||||
synonym for ``django.views.decorators.csrf.csrf_exempt``, which should
|
synonym for ``django.views.decorators.csrf.csrf_exempt``, which should
|
||||||
be used to replace it.
|
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
|
* 2.0
|
||||||
* ``django.views.defaults.shortcut()``. This function has been moved
|
* ``django.views.defaults.shortcut()``. This function has been moved
|
||||||
to ``django.contrib.contenttypes.views.shortcut()`` as part of the
|
to ``django.contrib.contenttypes.views.shortcut()`` as part of the
|
||||||
|
|
Loading…
Reference in New Issue