From 8c28bcf52d0851e08984af5dc83d01934b33129d Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 14 Apr 2011 13:28:07 +0200 Subject: [PATCH 1/4] Use the class based loader in the docs. --- docs/overview.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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:: From e11c2ee71d30c6b7e06d3e52035d1562b15bc423 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 14 Apr 2011 13:38:00 +0200 Subject: [PATCH 2/4] Only check for old-style caches if the value is a string (e.g. locmem://). --- dbtemplates/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbtemplates/settings.py b/dbtemplates/settings.py index 5354b89..4a13db7 100644 --- a/dbtemplates/settings.py +++ b/dbtemplates/settings.py @@ -9,7 +9,7 @@ cache = getattr(settings, "CACHES", {}).get("dbtemplates", 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 From ae6818f74583b82656d9bac5d89ccbb1b8e0fe84 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 14 Apr 2011 13:38:09 +0200 Subject: [PATCH 3/4] Fixed cache setting handling. Fixes issue #4. --- dbtemplates/settings.py | 10 ++++++---- dbtemplates/utils.py | 6 +----- 2 files changed, 7 insertions(+), 9 deletions(-) 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() From 1dc6580b675fc85b0f17b00b93da444fcd26bf20 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 14 Apr 2011 13:46:15 +0200 Subject: [PATCH 4/4] Bumped to 1.0.1. --- dbtemplates/__init__.py | 2 +- docs/conf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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.