Merge branch 'hotfix/cache-fixes' into develop

This commit is contained in:
Jannis Leidel 2011-04-14 13:46:30 +02:00
commit c530146dd5
5 changed files with 12 additions and 14 deletions

View file

@ -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

View file

@ -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

View file

@ -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()

View file

@ -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.

View file

@ -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::