comparison makeitso/template.py @ 101:80a57bf2b7f4

fixed a few problems
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 11 Jan 2011 14:23:17 -0800
parents b54898f7d8a9
children 51c9cb49edec
comparison
equal deleted inserted replaced
100:b54898f7d8a9 101:80a57bf2b7f4
158 variables=vars) 158 variables=vars)
159 missing.update(template.missing()) 159 missing.update(template.missing())
160 160
161 return missing 161 return missing
162 162
163 def pre(self, variables): 163 def pre(self, variables, output):
164 """do stuff before interpolation""" 164 """do stuff before interpolation"""
165 165
166 def substitute(self, variables, output=None): 166 def substitute(self, variables, output=None):
167 """do the substitution""" 167 """do the substitution"""
168 168
169 vars = self.get_variables(**variables) 169 vars = self.get_variables(**variables)
170 self.pre(vars) 170 self.pre(vars, output)
171 self.check_missing(vars) 171 self.check_missing(vars)
172 172
173 # do the substitution 173 # do the substitution
174 template = PolyTemplate(self._templates, 174 template = PolyTemplate(self._templates,
175 interactive=self.interactive, 175 interactive=self.interactive,
176 variables=vars) 176 variables=vars)
177 template.check_output(output) 177 template.check_output(output)
178 template.substitute({}, output) 178 template.substitute({}, output)
179 179
180 self.post(vars) 180 self.post(vars, output)
181 181
182 def post(self, variables): 182 def post(self, variables, output):
183 """do stuff after interpolation""" 183 """do stuff after interpolation"""
184 184
185 def read_variables(self, variables): 185 def read_variables(self, variables):
186 """read variables from stdin""" 186 """read variables from stdin"""
187 retval = {} 187 retval = {}