[damned-lies] Allow easier template loaders override by local_settings



commit 5b577963e48dcae82ee9404a580f694a5d9f838e
Author: Claude Paroz <claude 2xlibre net>
Date:   Wed May 18 22:41:53 2016 +0200

    Allow easier template loaders override by local_settings
    
    Without that trick, local_settings would have to override the whole
    new TEMPLATES setting just to remove the cached template loader.

 damnedlies/settings.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/damnedlies/settings.py b/damnedlies/settings.py
index bc07953..4dd9493 100644
--- a/damnedlies/settings.py
+++ b/damnedlies/settings.py
@@ -163,6 +163,13 @@ try:
 except ImportError:
     raise ImportError("The damnedlies/local_settings.py file is mandatory. See the README file.")
 
+# Allowing local_settings to override template loaders (not cached on dev)
+try:
+    TEMPLATES[0]['OPTIONS']['loaders'] = TEMPLATE_LOADERS
+    del TEMPLATE_LOADERS
+except NameError:
+    pass
+
 # When running in development mode, print emails on stdout instead of trying
 # to send them
 if DEBUG:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]