mirror of
https://github.com/jazzband/django-dbtemplates.git
synced 2026-03-16 22:20:28 +00:00
Fixed docstring in template loader.
Fixed wrong return types in FileSystemBackend. git-svn-id: https://django-dbtemplates.googlecode.com/svn/trunk@59 cfb8ba98-e953-0410-9cff-959ffddf5974 committer: leidel <leidel@cfb8ba98-e953-0410-9cff-959ffddf5974> --HG-- extra : convert_revision : 7ea05e043c43c23fbf846bc9ddd80400519631e2
This commit is contained in:
parent
41ff350628
commit
9f0d7a2564
2 changed files with 6 additions and 8 deletions
|
|
@ -62,7 +62,7 @@ class FileSystemBackend(BaseCacheBackend):
|
|||
self.cache_dir = getattr(settings, 'DBTEMPLATES_CACHE_DIR', None)
|
||||
self.cache_dir = os.path.normpath(self.cache_dir)
|
||||
if not os.path.isdir(self.cache_dir):
|
||||
raise Exception
|
||||
pass
|
||||
except:
|
||||
raise ImproperlyConfigured('You\'re using the dbtemplates\' file system cache backend without having set the DBTEMPLATES_CACHE_DIR setting to a valid value. Make sure the directory exists and is writeable for the user your Django instance is running with.')
|
||||
super(FileSystemBackend, self).__init__()
|
||||
|
|
@ -75,7 +75,7 @@ class FileSystemBackend(BaseCacheBackend):
|
|||
filepath = self._filepath(name)
|
||||
return open(filepath).read().decode('utf-8')
|
||||
except:
|
||||
raise None
|
||||
return None
|
||||
|
||||
def save(self, name, content, retry=False):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -7,12 +7,10 @@ from dbtemplates.models import Template, backend
|
|||
|
||||
def load_template_source(template_name, template_dirs=None):
|
||||
"""
|
||||
Tries to load the template from DBTEMPLATES_CACHE_DIR. If it does not
|
||||
exist loads templates from the database by querying the database field
|
||||
``name`` with a template path and ``sites`` with the current site,
|
||||
and tries to save the template as DBTEMPLATES_CACHE_DIR/``name`` for
|
||||
subsequent requests. If DBTEMPLATES_CACHE_DIR is not configured falls
|
||||
back to database-only operation.
|
||||
Tries to load the template from the dbtemplates cache backend specified
|
||||
by the DBTEMPLATES_CACHE_BACKEND setting. If it does not find a template
|
||||
it falls back to query the database field ``name`` with the template path
|
||||
and ``sites`` with the current site.
|
||||
"""
|
||||
display_name = 'db:%s:%s' % (settings.DATABASE_ENGINE, template_name)
|
||||
if backend:
|
||||
|
|
|
|||
Loading…
Reference in a new issue