diff --git a/dbtemplates/__init__.py b/dbtemplates/__init__.py index 2f7c2e2..7bba090 100644 --- a/dbtemplates/__init__.py +++ b/dbtemplates/__init__.py @@ -1,4 +1,4 @@ -VERSION = (1, 0, 0, "f", 0) # following PEP 386 +VERSION = (1, 0, 1, "f", 0) # following PEP 386 DEV_N = None diff --git a/dbtemplates/settings.py b/dbtemplates/settings.py index 5354b89..c982e70 100644 --- a/dbtemplates/settings.py +++ b/dbtemplates/settings.py @@ -2,14 +2,16 @@ 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.") -elif cache.startswith("dbtemplates."): +elif isinstance(cache, basestring) and cache.startswith("dbtemplates."): raise ImproperlyConfigured("Please upgrade to one of the supported " "backends as defined in the Django docs.") CACHE_BACKEND = cache 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() diff --git a/docs/conf.py b/docs/conf.py index 101e1cf..ee20d84 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,7 +47,7 @@ copyright = u'2010, Jannis Leidel' # The short X.Y version. version = '1.0' # The full version, including alpha/beta/rc tags. -release = '1.0' +release = '1.0.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/overview.txt b/docs/overview.txt index f9f77c4..2465a3c 100644 --- a/docs/overview.txt +++ b/docs/overview.txt @@ -24,8 +24,8 @@ Setup 'dbtemplates', ) - * Add ``dbtemplates.loader.load_template_source`` to the - ``TEMPLATE_LOADERS`` list in the settings.py of your Django project + * Add ``dbtemplates.loader.Loader`` to the ``TEMPLATE_LOADERS`` list + in the settings.py of your Django project. It should look something like this::