[tor-commits] [bridgedb/develop] Change Mako template lookups to ignore atime checks.

isis at torproject.org isis at torproject.org
Sat Feb 1 23:57:39 UTC 2014


commit 3c2100f4be0952b1e1e9fcfc0bfab7b90acf1549
Author: Isis Lovecruft <isis at torproject.org>
Date:   Tue Jan 28 16:16:53 2014 +0000

    Change Mako template lookups to ignore atime checks.
    
     * CHANGE Mako template lookups to ignore atime filesystem checks, using
       only compiled template and not reloading from file.
---
 lib/bridgedb/HTTPServer.py |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/bridgedb/HTTPServer.py b/lib/bridgedb/HTTPServer.py
index 65702ba..2668e31 100644
--- a/lib/bridgedb/HTTPServer.py
+++ b/lib/bridgedb/HTTPServer.py
@@ -40,10 +40,18 @@ from mako.lookup import TemplateLookup
 from zope.interface import Interface, Attribute, implements
 
 template_root = os.path.join(os.path.dirname(__file__),'templates')
-lookup = TemplateLookup(directories=[template_root],
-                        output_encoding='utf-8')
 rtl_langs = ('ar', 'he', 'fa', 'gu_IN', 'ku')
 
+# Setting `filesystem_checks` to False is recommended for production servers,
+# due to potential speed increases. This means that the atimes of the Mako
+# template files aren't rechecked every time the template is requested
+# (otherwise, if they are checked, and the atime is newer, the template is
+# recompiled). See:
+# http://docs.makotemplates.org/en/latest/usage.html#setting-filesystem-checks
+lookup = TemplateLookup(directories=[template_root],
+                        output_encoding='utf-8',
+                        filesystem_checks=False)
+
 logging.debug("Set template root to %s" % template_root)
 
 try:





More information about the tor-commits mailing list