comparison piecrust/baking/baker.py @ 42:9e058e221108

Fix a crash when checking for timestamps on template files.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 21 Aug 2014 22:51:52 -0700
parents 2f717f961996
children efd0d3bacc9e
comparison
equal deleted inserted replaced
41:1a30e3d7ee47 42:9e058e221108
318 # Check if any template has changed since the last bake. Since 318 # Check if any template has changed since the last bake. Since
319 # there could be some advanced conditional logic going on, we'd 319 # there could be some advanced conditional logic going on, we'd
320 # better just force a bake from scratch if that's the case. 320 # better just force a bake from scratch if that's the case.
321 max_time = 0 321 max_time = 0
322 for d in self.app.templates_dirs: 322 for d in self.app.templates_dirs:
323 for _, __, filenames in os.walk(d): 323 for dpath, _, filenames in os.walk(d):
324 for fn in filenames: 324 for fn in filenames:
325 max_time = max(max_time, os.path.getmtime(fn)) 325 full_fn = os.path.join(dpath, fn)
326 max_time = max(max_time, os.path.getmtime(full_fn))
326 if max_time >= record.previous.bake_time: 327 if max_time >= record.previous.bake_time:
327 reason = "templates modified" 328 reason = "templates modified"
328 329
329 if reason is not None: 330 if reason is not None:
330 cache_dir = self.app.cache_dir 331 cache_dir = self.app.cache_dir