Mercurial > hg > MakeItSo
diff makeitso/makeitso.py @ 94:b6a46332cced
allow Polytemplates to take template objects
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 11 Jan 2011 07:33:59 -0800 |
parents | d5da38fabdf7 |
children | 80a57bf2b7f4 |
line wrap: on
line diff
--- a/makeitso/makeitso.py Tue Jan 11 07:30:31 2011 -0800 +++ b/makeitso/makeitso.py Tue Jan 11 07:33:59 2011 -0800 @@ -324,14 +324,17 @@ def __init__(self, templates, interactive=True, variables=None): self.interactive = interactive - self._templates = templates[:] self.templates = [] for template in templates: - # TODO: check if the template is a [e.g] PasteScript.template entry point - if os.path.isdir(template): - self.templates.append(DirectoryTemplate(template, interactive=self.interactive, variables=variables)) + if isinstance(template, basestring): + # TODO: check if the template is a [e.g] PasteScript.template entry point + if os.path.isdir(template): + self.templates.append(DirectoryTemplate(template, interactive=self.interactive, variables=variables)) + else: + self.templates.append(URITemplate(template, interactive=self.interactive, variables=variables)) else: - self.templates.append(URITemplate(template, interactive=self.interactive, variables=variables)) + # assume the template is an object that conforms to the API + self.templates.append(template) def missing(self, **variables): vars = variables.copy()