Mercurial > hg > MakeItSo
comparison makeitso/makeitso.py @ 37:7cee2869bd7b
stub out directory example
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Sat, 01 Jan 2011 22:28:35 -0800 |
| parents | 0cba953a03ca |
| children | 9739212a63c3 |
comparison
equal
deleted
inserted
replaced
| 36:0cba953a03ca | 37:7cee2869bd7b |
|---|---|
| 193 **variables) | 193 **variables) |
| 194 | 194 |
| 195 def substitute(self, **variables): | 195 def substitute(self, **variables): |
| 196 output = ContentTemplate.substitute(self, **variables) | 196 output = ContentTemplate.substitute(self, **variables) |
| 197 f = self.output | 197 f = self.output |
| 198 | |
| 198 if isinstance(f, basestring): | 199 if isinstance(f, basestring): |
| 199 if os.path.isdir(f): | 200 if os.path.isdir(f): |
| 200 f = os.path.join(f, basename(self.name)) | 201 f = os.path.join(f, basename(self.name)) |
| 201 f = file(f, 'w') | 202 f = file(f, 'w') |
| 202 print >> f, output | 203 print >> f, output |
| 203 | 204 f.close() |
| 205 else: | |
| 206 print >> f, output | |
| 204 | 207 |
| 205 class DirectoryTemplate(ContentTemplate): | 208 class DirectoryTemplate(ContentTemplate): |
| 206 """template for a directory structure""" | 209 """template for a directory structure""" |
| 207 | 210 |
| 208 def __init__(self, directory, output=None, interactive=True, **variables): | 211 def __init__(self, directory, output=None, interactive=True, **variables): |
