changeset 38:9739212a63c3

found a serious problem: directories stubbornly substitute into themselves
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 01 Jan 2011 22:34:29 -0800
parents 7cee2869bd7b
children a2cdce0108e1
files examples/doctest.txt makeitso/makeitso.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/examples/doctest.txt	Sat Jan 01 22:28:35 2011 -0800
+++ b/examples/doctest.txt	Sat Jan 01 22:34:29 2011 -0800
@@ -42,4 +42,6 @@
     >>> template = makeitso.PolyTemplate([exampledir], output=tempdir, interactive=False)
     >>> sorted(template.missing())
     ['bar', 'foo', 'subdir']
-    >>> shutil.rmtree(tempdir)
+    >>> template.substitute(foo='myfoo', bar='mybar', subdir='mysubdir')
+    >>> os.listdir(tempdir)
+    
--- a/makeitso/makeitso.py	Sat Jan 01 22:28:35 2011 -0800
+++ b/makeitso/makeitso.py	Sat Jan 01 22:34:29 2011 -0800
@@ -255,8 +255,8 @@
             
             # interpolate directory names
             for d in dirnames:
-                path = os.path.join(dirname, interpolated)
-                interpolated = ContentTemplate(path).substitute(**variables)
+                path = os.path.join(dirname, d)                
+                interpolated = ContentTemplate(path).substitute(**variables)                
                 if os.path.exists(interpolated):
                     # ensure its a directory
                     pass