diff --git a/dbtemplates/settings.py b/dbtemplates/settings.py index 4a13db7..c982e70 100644 --- a/dbtemplates/settings.py +++ b/dbtemplates/settings.py @@ -2,10 +2,12 @@ import posixpath from django.conf import settings from django.core.exceptions import ImproperlyConfigured -# If we are on Django 1.3 AND using the new CACHES setting... -cache = getattr(settings, "CACHES", {}).get("dbtemplates", - # .. or fall back to the old CACHE_BACKEND setting - getattr(settings, "DBTEMPLATES_CACHE_BACKEND", None)) +if "dbtemplates" in getattr(settings, "CACHES", {}): + # If we are on Django 1.3 AND using the new CACHES setting.. + cache = "dbtemplates" +else: + # ..or fall back to the old CACHE_BACKEND setting + cache = getattr(settings, "DBTEMPLATES_CACHE_BACKEND", None) if not cache: raise ImproperlyConfigured("Please specify a dbtemplates " "cache backend in your settings.") diff --git a/dbtemplates/utils.py b/dbtemplates/utils.py index 8531748..61e9f14 100644 --- a/dbtemplates/utils.py +++ b/dbtemplates/utils.py @@ -9,11 +9,7 @@ from dbtemplates import settings def get_cache_backend(): - if "://" in settings.CACHE_BACKEND: - cache = get_cache(settings.CACHE_BACKEND) - else: - cache = get_cache(**settings.CACHE_BACKEND) - return cache + return get_cache(settings.CACHE_BACKEND) cache = get_cache_backend()