Commits

Andriy Kornatskyy committed 1917616

Added ProprocessLoader.

Comments (0)

Files changed (1)

src/wheezy/template/loader.py

         return None
 
 
+class PreprocessLoader(object):
+    """ Performs preprocessing of loaded template.
+    """
+
+    def __init__(self, engine, ctx=None):
+        self.engine = engine
+        self.ctx = ctx or {}
+
+    def list_names(self):
+        return self.engine.loader.list_names()
+
+    def load(self, name):
+        return self.engine.render(name, self.ctx, {}, {})
+
+
 def autoreload(engine, enabled=True):
     """ Auto reload template if changes are detected in file. Limitation:
         inherited and imported templates.