changeset 13187:e3b87fb34d00

templater: clarify engine caching
author Matt Mackall <mpm@selenic.com>
date Wed, 22 Dec 2010 13:16:03 -0600
parents fda7ae939344
children f5be619663f9
files mercurial/templater.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Wed Dec 22 13:16:00 2010 -0600
+++ b/mercurial/templater.py	Wed Dec 22 13:16:03 2010 -0600
@@ -282,7 +282,7 @@
         self.filters.update(filters)
         self.defaults = defaults
         self.minchunk, self.maxchunk = minchunk, maxchunk
-        self.engines = {}
+        self.ecache = {}
 
         if not mapfile:
             return
@@ -322,10 +322,10 @@
 
     def __call__(self, t, **mapping):
         ttype = t in self.map and self.map[t][0] or 'default'
-        proc = self.engines.get(ttype)
-        if proc is None:
-            proc = engines[ttype](self.load, self.filters, self.defaults)
-            self.engines[ttype] = proc
+        if ttype not in self.ecache:
+            self.ecache[ttype] = engines[ttype](self.load,
+                                                 self.filters, self.defaults)
+        proc = self.ecache[ttype]
 
         stream = proc.process(t, mapping)
         if self.minchunk: