Revision bb762ce4
Added by Thomas Noël almost 10 years ago
entrouvert/djommon/multitenant/middleware.py | ||
---|---|---|
33 | 33 |
@classmethod |
34 | 34 |
def get_tenant_by_hostname(cls, hostname): |
35 | 35 |
'''Retrieve a tenant object for this hostname''' |
36 |
schema = cls.hostname2schema(hostname) |
|
37 |
p = os.path.join(cls.base(), schema) |
|
38 |
if not os.path.exists(p): |
|
36 |
if not os.path.exists(os.path.join(cls.base(), hostname)): |
|
39 | 37 |
raise TenantNotFound |
38 |
schema = cls.hostname2schema(hostname) |
|
40 | 39 |
return get_tenant_model()(schema_name=schema, domain_url=hostname) |
41 | 40 |
|
42 | 41 |
@classmethod |
... | ... | |
118 | 117 |
FILENAME = None |
119 | 118 |
|
120 | 119 |
def load_tenant_settings(self, wrapped, tenant, tenant_settings, last_time): |
121 |
path = os.path.join(settings.TENANT_BASE, tenant.schema_name, self.FILENAME)
|
|
120 |
path = os.path.join(settings.TENANT_BASE, tenant.domain_url, self.FILENAME)
|
|
122 | 121 |
try: |
123 | 122 |
new_time = os.stat(path).st_mtime |
124 | 123 |
except OSError: |
Also available in: Unified diff
tenants in TENANT_BASE/hostname (#6398)