Commits

Andriy Kornatskyy committed ac0d34c

Introduced DictLoader.

  • Participants
  • Parent commits f010896

Comments (0)

Files changed (1)

src/wheezy/template/loader.py

                 f.close()
         else:
             return None
+
+
+class DictLoader(object):
+
+    def __init__(self, templates):
+        self.templates = templates
+
+    def list_names(self):
+        return list(self.templates.keys())
+
+    def load(self, name):
+        if name not in self.templates:
+            return None
+        return self.templates[name]