Skip to content

Commit

Permalink
Fix CachedLoader when template_dirs is None
Browse files Browse the repository at this point in the history
From Django 1.10 onwards, `template_dirs` isn't passed while getting the template: https://github.com/django/django/blob/1.10/django/template/engine.py#L155. This causes multi tenant template cache to fail as the cache key is dependent on template_dirs.
  • Loading branch information
karthikprabhu authored Aug 6, 2017
1 parent 70fef87 commit ac3c447
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tenant_schemas/template_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def __init__(self, engine, loaders):

@staticmethod
def cache_key(template_name, template_dirs):
if connection.tenant and template_dirs:
if connection.tenant:
if not template_dirs:
template_dirs = settings.MULTITENANT_TEMPLATE_DIRS
return '-'.join([str(connection.tenant.pk), template_name,
hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()])
if template_dirs:
Expand Down

0 comments on commit ac3c447

Please sign in to comment.