Project

General

Profile

0003-In-FileSystemLoader-use-the-schema-name-instead-of-t.patch

Benjamin Dauvergne, 20 August 2014 03:23 PM

Download (1.87 KB)

View differences:

Subject: [PATCH 03/10] In FileSystemLoader use the schema name instead of the
 domain name for building template path

Also add a templates/ suffix.
 entrouvert/djommon/multitenant/template_loader.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
entrouvert/djommon/multitenant/template_loader.py
51 51
        if template_dirs:
52 52
            # If template directories were specified, use a hash to differentiate
53 53
            if connection.tenant:
54
                key = '-'.join([str(connection.tenant.pk), template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
54
                key = '-'.join([str(connection.tenant.schema_name), template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
55 55
            else:
56 56
                key = '-'.join([template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
57 57

  
......
91 91
                raise ImproperlyConfigured('To use %s.%s you must define the TENANT_TEMPLATE_DIRS' % (__name__, FilesystemLoader.__name__))
92 92
        for template_dir in template_dirs:
93 93
            try:
94
                yield safe_join(template_dir, connection.tenant.domain_url, template_name)
94
                yield safe_join(template_dir, connection.tenant.schema_name, 'templates', template_name)
95 95
            except UnicodeDecodeError:
96 96
                # The template dir name was a bytestring that wasn't valid UTF-8.
97 97
                raise
98
-