From b0e61f5ba60b30800fc50639eaf52cea2ec9b4fd Mon Sep 17 00:00:00 2001 From: "arne@rcs4u.de" Date: Thu, 17 Apr 2008 12:52:57 +0000 Subject: [PATCH] fix for templates which have (multiple) directories in their name git-svn-id: https://django-dbtemplates.googlecode.com/svn/trunk@25 cfb8ba98-e953-0410-9cff-959ffddf5974 committer: arne@rcs4u.de --HG-- extra : convert_revision : 71ab553013820fadcb623a2039d0c51a7ff7f271 --- dbtemplates/loader.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dbtemplates/loader.py b/dbtemplates/loader.py index 6af8296..720f6bf 100644 --- a/dbtemplates/loader.py +++ b/dbtemplates/loader.py @@ -41,7 +41,13 @@ def load_template_source(template_name, template_dirs=None): f.write(t.content) f.close() except IOError: - pass + try: + head, tail = os.path.split(filepath) + if head and not os.path.isdir(head): + os.makedirs(head) + except Exception: + pass + return (t.content, 'db:%s:%s' % (settings.DATABASE_ENGINE, template_name)) except: pass @@ -57,7 +63,7 @@ load_template_source.is_usable = True def remove_cached_template(instance): """ Called via django's signals to remove cached templates, if the template in the - database was changed. + database was changed or deleted. """ if cache_dir is not None: try: