chiark / gitweb /
cgi.py: Export the template cache to the templates.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 16 Mar 2013 17:29:39 +0000 (17:29 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 16 Mar 2013 17:45:05 +0000 (17:45 +0000)
Now they can invoke each other with `~=TMPL[NAME]@?'.

cgi.py

diff --git a/cgi.py b/cgi.py
index 26295e0..b25d2d2 100644 (file)
--- a/cgi.py
+++ b/cgi.py
@@ -213,7 +213,7 @@ class TemplateFinder (object):
     with open(OS.path.join(me._dir, key)) as f: tmpl = f.read()
     me._cache[key] = tmpl
     return tmpl
-TMPL = TemplateFinder(TMPLDIR)
+STATE.kw['TMPL'] = TMPL = TemplateFinder(TMPLDIR)
 
 @CTX.contextmanager
 def tmplkw(**kw):