comparison piecrust/page.py @ 112:d31cbbdb4ecc

Use cache paths that are easier to debug than hashes.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 19 Oct 2014 00:25:02 -0700
parents b6ec402d32bb
children 28444014ce7d
comparison
equal deleted inserted replaced
111:208c652551a3 112:d31cbbdb4ecc
207 207
208 208
209 def _do_load_page(app, path, path_mtime): 209 def _do_load_page(app, path, path_mtime):
210 # Check the cache first. 210 # Check the cache first.
211 cache = app.cache.getCache('pages') 211 cache = app.cache.getCache('pages')
212 cache_path = "%s.json" % hashlib.md5(path.encode('utf8')).hexdigest() 212 rel_path = os.path.relpath(path, app.root_dir)
213 cache_path = "%s.json" % rel_path.replace('/', '_').strip('_')
213 page_time = path_mtime or os.path.getmtime(path) 214 page_time = path_mtime or os.path.getmtime(path)
214 if cache.isValid(cache_path, page_time): 215 if cache.isValid(cache_path, page_time):
215 cache_data = json.loads(cache.read(cache_path), 216 cache_data = json.loads(cache.read(cache_path),
216 object_pairs_hook=collections.OrderedDict) 217 object_pairs_hook=collections.OrderedDict)
217 config = PageConfiguration(values=cache_data['config'], 218 config = PageConfiguration(values=cache_data['config'],