diff makeitso/makeitso.py @ 87:3571417ef92e

interpolate file permissions
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 10 Jan 2011 14:39:21 -0800
parents 2c1310e94645
children 712a6d358083
line wrap: on
line diff
--- a/makeitso/makeitso.py	Mon Jan 10 12:39:26 2011 -0800
+++ b/makeitso/makeitso.py	Mon Jan 10 14:39:21 2011 -0800
@@ -216,18 +216,18 @@
         f = self.output
         
         if isinstance(f, basestring):
+            path = f
             if os.path.isdir(f):
-                f = os.path.join(f, basename(self.name))
-            f = file(f, 'w')
+                path = os.path.join(path, basename(self.name))
+            f = file(path, 'w')
             print >> f, output
             f.close()
+            try:
+                os.chmod(f, os.stat(self.name).st_mode)
+            except:
+                pass
         else:
             print >> f, output
-        try:
-            os.chmod(self.output, os.stat(self.name).st_mode)
-        except:
-            pass
-
 
 class DirectoryTemplate(ContentTemplate):
     """template for a directory structure"""