In FileSystemLoader use the schema name instead of the domain name for building template path

Also add a templates/ suffix.

refs #5106
This commit is contained in:
Benjamin Dauvergne 2014-08-19 11:05:08 +02:00
parent 73b85f5d53
commit 392340cfb8
1 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ class CachedLoader(BaseLoader):
if template_dirs:
# If template directories were specified, use a hash to differentiate
if connection.tenant:
key = '-'.join([str(connection.tenant.pk), template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
key = '-'.join([str(connection.tenant.schema_name), template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
else:
key = '-'.join([template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
@ -89,7 +89,7 @@ class FilesystemLoader(BaseLoader):
raise ImproperlyConfigured('To use %s.%s you must define the TENANT_TEMPLATE_DIRS' % (__name__, FilesystemLoader.__name__))
for template_dir in template_dirs:
try:
yield safe_join(template_dir, connection.tenant.domain_url, template_name)
yield safe_join(template_dir, connection.tenant.schema_name, 'templates', template_name)
except UnicodeDecodeError:
# The template dir name was a bytestring that wasn't valid UTF-8.
raise