From 85d8cb15bb239f717e9f473c95277c143f6fab52 Mon Sep 17 00:00:00 2001 From: Markus Kaiserswerth Date: Tue, 18 Mar 2014 16:37:18 +0100 Subject: [PATCH] Added a DeprecationWarning if Async cache file backend is used --- imagekit/cachefiles/backends.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/imagekit/cachefiles/backends.py b/imagekit/cachefiles/backends.py index a781dc7..49bc75c 100644 --- a/imagekit/cachefiles/backends.py +++ b/imagekit/cachefiles/backends.py @@ -1,4 +1,5 @@ from ..utils import get_singleton, sanitize_cache_key +import warnings from copy import copy from django.core.cache import get_cache from django.core.exceptions import ImproperlyConfigured @@ -160,7 +161,12 @@ class Celery(BaseAsync): _celery_task.delay(self, file, force=force) -Async = Celery # backwards compatibility +# Stub class to preserve backwards compatibility and issue a warning +class Async(Celery): + def __init__(self, *args, **kwargs): + message = '{path}.Async is deprecated. Use {path}.Celery instead.' + warnings.warn(message.format(path=__name__), DeprecationWarning) + super(Async, self).__init__(*args, **kwargs) try: