comparison piecrust/baking/baker.py @ 7:343d08ef5668

More PieCrust 3 fixes, and a couple of miscellaneous bug fixes.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 16 Aug 2014 15:07:22 -0700
parents f5ca5c5bed85
children 617191dec18e
comparison
equal deleted inserted replaced
6:f5ca5c5bed85 7:343d08ef5668
190 190
191 out_dir = os.path.dirname(out_path) 191 out_dir = os.path.dirname(out_path)
192 if not os.path.isdir(out_dir): 192 if not os.path.isdir(out_dir):
193 os.makedirs(out_dir, 0o755) 193 os.makedirs(out_dir, 0o755)
194 194
195 with codecs.open(out_path, 'w', 'utf-8') as fp: 195 with codecs.open(out_path, 'w', 'utf8') as fp:
196 fp.write(rp.content) 196 fp.write(rp.content)
197 197
198 return ctx, rp 198 return ctx, rp
199 199
200 200
233 os.makedirs(self.out_dir, 0o755) 233 os.makedirs(self.out_dir, 0o755)
234 234
235 # Load/create the bake record. 235 # Load/create the bake record.
236 record = TransitionalBakeRecord() 236 record = TransitionalBakeRecord()
237 record_cache = self.app.cache.getCache('bake_r') 237 record_cache = self.app.cache.getCache('bake_r')
238 record_name = hashlib.md5(self.out_dir).hexdigest() + '.record' 238 record_name = (hashlib.md5(self.out_dir.encode('utf8')).hexdigest() +
239 '.record')
239 if not self.force and record_cache.has(record_name): 240 if not self.force and record_cache.has(record_name):
240 t = time.clock() 241 t = time.clock()
241 record.loadPrevious(record_cache.getCachePath(record_name)) 242 record.loadPrevious(record_cache.getCachePath(record_name))
242 logger.debug(format_timed(t, 'loaded previous bake record', 243 logger.debug(format_timed(t, 'loaded previous bake record',
243 colored=False)); 244 colored=False));