[bridgedb/master] PEP8; change template_root → TEMPLATE_DIR.

isis at torproject.org isis at torproject.org
Sat Apr 19 17:02:43 UTC 2014


commit 4a9eb669830ae8a3d12335227cce7c34b5002193
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Apr 16 19:38:44 2014 +0000

    PEP8; change template_root → TEMPLATE_DIR.
---
 lib/bridgedb/HTTPServer.py |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/bridgedb/HTTPServer.py b/lib/bridgedb/HTTPServer.py
index 5e3ba37..1d4cdf9 100644
--- a/lib/bridgedb/HTTPServer.py
+++ b/lib/bridgedb/HTTPServer.py
@@ -44,10 +44,7 @@ from bridgedb.parse import headers
 from bridgedb.safelog import logSafely
 
 
-
-template_root = os.path.join(os.path.dirname(__file__),'templates')
-logging.debug("Set template root to %s" % template_root)
-
+TEMPLATE_DIR = os.path.join(os.path.dirname(__file__),'templates')
 rtl_langs = ('ar', 'he', 'fa', 'gu_IN', 'ku')
 
 # Setting `filesystem_checks` to False is recommended for production servers,
@@ -57,13 +54,14 @@ rtl_langs = ('ar', 'he', 'fa', 'gu_IN', 'ku')
 # recompiled). `collection_size` sets the number of compiled templates which
 # are cached before the least recently used ones are removed. See:
 # http://docs.makotemplates.org/en/latest/usage.html#using-templatelookup
-lookup = TemplateLookup(directories=[template_root],
+lookup = TemplateLookup(directories=[TEMPLATE_DIR],
                         output_encoding='utf-8',
                         filesystem_checks=False,
                         collection_size=500)
 
 
 _geoipdb = '/usr/share/GeoIP/GeoIP.dat'
+logging.debug("Set template root to %s" % TEMPLATE_DIR)
 
 try:
     # Make sure we have the database before trying to import the module:
@@ -822,9 +820,9 @@ def addWebServer(cfg, dist, sched):
     httpdist = resource.Resource()
     httpdist.putChild('', WebRoot())
     httpdist.putChild('robots.txt',
-                      static.File(os.path.join(template_root, 'robots.txt')))
+                      static.File(os.path.join(TEMPLATE_DIR, 'robots.txt')))
     httpdist.putChild('assets',
-                      static.File(os.path.join(template_root, 'assets/')))
+                      static.File(os.path.join(TEMPLATE_DIR, 'assets/')))
     httpdist.putChild('options', WebResourceOptions())
     httpdist.putChild('howto', WebResourceHowto())
 





More information about the tor-commits mailing list