0002-In-FileSystemLoader-rename-settings-from-MULTITENANT.patch
entrouvert/djommon/multitenant/app_settings.py | ||
---|---|---|
1 |
import sys |
|
2 | ||
3 | ||
4 |
class AppSettings: |
|
5 |
@property |
|
6 |
def settings(self): |
|
7 |
if not hasattr(self, '_settings'): |
|
8 |
from django.conf import settings |
|
9 |
self._settings = settings |
|
10 |
return self._settings |
|
11 | ||
12 |
@property |
|
13 |
def MULTITENANT_TEMPLATE_DIRS(self): |
|
14 |
return self.settings.MULTITENANT_TEMPLATE_DIRS |
|
15 | ||
16 | ||
17 |
app_settings = AppSettings() |
|
18 |
app_settings.__name__ = __name__ |
|
19 |
sys.modules[__name__] = app_settings |
entrouvert/djommon/multitenant/template_loader.py | ||
---|---|---|
86 | 86 |
return |
87 | 87 |
if not template_dirs: |
88 | 88 |
try: |
89 |
template_dirs = app_settings.MULTITENANT_TEMPLATE_DIRS
|
|
89 |
template_dirs = settings.TENANT_TEMPLATE_DIRS
|
|
90 | 90 |
except AttributeError: |
91 |
raise ImproperlyConfigured('To use %s.%s you must define the MULTITENANT_TEMPLATE_DIRS' % (__name__, FilesystemLoader.__name__))
|
|
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 | 94 |
yield safe_join(template_dir, connection.tenant.domain_url, template_name) |
... | ... | |
112 | 112 |
if tried: |
113 | 113 |
error_msg = "Tried %s" % tried |
114 | 114 |
else: |
115 |
error_msg = "Your TEMPLATE_DIRS setting is empty. Change it to point to at least one template directory." |
|
115 |
error_msg = "Your TENANT_TEMPLATE_DIRS setting is empty. Change it to point to at least one template directory."
|
|
116 | 116 |
raise TemplateDoesNotExist(error_msg) |
117 | 117 |
load_template_source.is_usable = True |
118 |
- |