Project

General

Profile

« Previous | Next » 

Revision 392340cf

Added by Benjamin Dauvergne over 10 years ago

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

Also add a templates/ suffix.

refs #5106

View differences:

entrouvert/djommon/multitenant/template_loader.py
49 49
        if template_dirs:
50 50
            # If template directories were specified, use a hash to differentiate
51 51
            if connection.tenant:
52
                key = '-'.join([str(connection.tenant.pk), template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
52
                key = '-'.join([str(connection.tenant.schema_name), template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
53 53
            else:
54 54
                key = '-'.join([template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
55 55

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

Also available in: Unified diff