diff makeitso/makeitso.py @ 35:7e47ff4b0cd3

started writing tests; what a surprise, everything is broken ;)
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 01 Jan 2011 21:58:34 -0800
parents 46c2d0a7335a
children 0cba953a03ca
line wrap: on
line diff
--- a/makeitso/makeitso.py	Sat Jan 01 21:21:53 2011 -0800
+++ b/makeitso/makeitso.py	Sat Jan 01 21:58:34 2011 -0800
@@ -155,7 +155,7 @@
         """interactive (for now) substitution"""
         vars = self.defaults.copy()
         vars.update(variables)
-        missing = self.missing(vars)
+        missing = self.missing(**vars)
         if missing:
             if self.interactive:
                 vars.update(self.read_variables(missing))
@@ -180,8 +180,7 @@
     """template for a file or URL"""
 
     def __init__(self, uri, output=None, interactive=True, **variables):
-        self.output = output or sys.stdout
-        
+        self.output = output or sys.stdout        
         content = include(uri)
         
         # remove makeitso shebang if it has one
@@ -270,7 +269,8 @@
     def __init__(self, templates, output=None, interactive=True, **variables):
 
         assert templates, "No templates given!"
-            
+
+        self._templates = templates[:]
         self.templates = []
         self.output = output
         for template in templates:
@@ -292,7 +292,7 @@
 
         # determine where the hell to put these things
         if self.output is None:
-            dirs = [i for i in templates if os.path.isdir(i)]
+            dirs = [i for i in self._templates if os.path.isdir(i)]
             if not ((len(dirs) == 0) or len(dirs) == len(templates)):
                 raise AssertionError("Must specify output when mixing directories and URIs")
         
@@ -355,7 +355,7 @@
         return
 
     # template variables
-    _vars = []
+    variables = {}
     _args = []
     for arg in args:
         if '=' in arg: