Mercurial > hg > MakeItSo
comparison makeitso/makeitso.py @ 112:51c9cb49edec
fix a few minor issues
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 14 Jan 2011 18:36:24 -0800 |
parents | 613e9c19a98c |
children | c3b8ce33d3ad |
comparison
equal
deleted
inserted
replaced
111:bad70fb08b15 | 112:51c9cb49edec |
---|---|
178 self.check_missing(vars) | 178 self.check_missing(vars) |
179 return tempita.Template.substitute(self, **vars) | 179 return tempita.Template.substitute(self, **vars) |
180 | 180 |
181 def read_variables(self, variables): | 181 def read_variables(self, variables): |
182 """read variables from stdin""" | 182 """read variables from stdin""" |
183 # TODO: variables should (optionally) be richer objects | |
184 retval = {} | 183 retval = {} |
185 for i in variables: | 184 for i in variables: |
186 print 'Enter %s: ' % i, | 185 print 'Enter %s: ' % i, |
187 retval[i] = raw_input() | 186 retval[i] = raw_input() |
188 return retval | 187 return retval |
339 self.templates.append(URITemplate(template, interactive=self.interactive, variables=variables)) | 338 self.templates.append(URITemplate(template, interactive=self.interactive, variables=variables)) |
340 else: | 339 else: |
341 # assume the template is an object that conforms to the API | 340 # assume the template is an object that conforms to the API |
342 self.templates.append(template) | 341 self.templates.append(template) |
343 | 342 |
343 def get_variables(self, **variables): | |
344 vars = variables.copy() | |
345 for template in self.templates: | |
346 vars.update(template.get_variables()) | |
347 return vars | |
348 | |
344 def missing(self, **variables): | 349 def missing(self, **variables): |
345 vars = variables.copy() | 350 vars = variables.copy() |
346 missing = set([]) | 351 missing = set([]) |
347 for template in self.templates: | 352 for template in self.templates: |
348 missed = template.missing(**vars) | 353 missed = template.missing(**vars) |