From b5455406ff7a5b3047348cd5e1a60090465c1e72 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Tue, 18 Jan 2011 05:21:11 +0800 Subject: [PATCH] Don't reference the old CACHE_BACKEND setting on projects using the Django 1.3 CACHES setting. --- compressor/conf/settings.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compressor/conf/settings.py b/compressor/conf/settings.py index 0050f5b..595c91e 100644 --- a/compressor/conf/settings.py +++ b/compressor/conf/settings.py @@ -54,4 +54,11 @@ PARSER = getattr(settings, 'COMPRESS_PARSER', 'compressor.parser.BeautifulSoupPa VERBOSE = getattr(settings, "COMPRESS_VERBOSE", False) # the cache backend to use -CACHE_BACKEND = getattr(settings, 'COMPRESS_CACHE_BACKEND', settings.CACHE_BACKEND) +CACHE_BACKEND = getattr(settings, 'COMPRESS_CACHE_BACKEND', None) +if CACHE_BACKEND is None: + # If we are on Django 1.3 AND using the new CACHES setting... + if getattr(settings, "CACHES", None): + CACHE_BACKEND = "default" + else: + # fallback for people still using the old CACHE_BACKEND setting + CACHE_BACKEND = settings.CACHE_BACKEND