grampajoe/django-tenant-templates — pull request #1 by macie-korte (2014-03-13 19:23:16+00:00)
Title: Make tenant-specific template loading work.

Makes custom error "Sorry" pages work.

We recently wrote custom 500 and 404 error-handling templates for our project containing different support contact information for our various tenants. We ran into the problem that unlike the other areas of our project, the error handling view was not rendering the correct template based on our tenant. It was always displaying the base template.

We traced the problem to the middleware of this library. It looks like if there is an error, then `process_exception()` deletes the tenant_slug variable.

The loader.py file in this library only returns a tenant-specific template path if `not template_name.startswith('./') and hasattr(local, 'tenant_slug') and local.tenant_slug is not None`. Since `hasattr(local, 'tenant_slug')` is False. we cannot get a tenant-specific template path.

This behavior seems very intentional as the code is concise and cleanly written and very specifically delete the tenant_slug attribute. So my question is: if so, then why? What's undesirable about having tenant-specific error-handling templates?

p.s. Hi Joe :wave: :smiley_cat: