changeset 64:c20277dbf8fa

closer to substitution
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 06 Jan 2011 18:04:58 -0800
parents b91133e3b02d
children 0152741621c1
files makeitso/template.py
diffstat 1 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/makeitso/template.py	Thu Jan 06 17:58:34 2011 -0800
+++ b/makeitso/template.py	Thu Jan 06 18:04:58 2011 -0800
@@ -110,14 +110,17 @@
     def missing(self, **variables):
         vars = self.get_variables(**variables)
         missing = set([])
+
+        # get known needed variables
+        for var in self.vars:
+            if var.name not in vars:
+                missing.add(var)
+
         if self.look:
-            pass
-        else:
-            for var in self.vars:
-                if self.usedefaults:
-                    import pdb; pdb.set_trace()
-                else:
-                    pass
+            # scan templates for other variables
+            raise NotImplementedError
+                
+        return missing
 
     def pre(self, **variables):
         """do stuff before interpolation"""
@@ -125,8 +128,16 @@
     def substitute(self, **variables):
         """do the substitution"""
         vars = self.get_variables(**variables)
-        self.pre(**variables)
+        self.pre(**vars)
         self.check_missing(vars)
+
+        # do the substitution
+        PolyTemplate(self.templates,
+                     output=self.output,
+                     interactive=self.interactive,
+                     variables = vars
+                     
+                     
         self.post(**variables)
 
     def post(self, **variables):