Mercurial > piecrust2
comparison piecrust/app.py @ 479:3b6cbadd0c64
themes: Add config paths to the cache key.
This makes PieCrust re-process the configuration when the user changes which
theme is currently applied to the site.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 20 Jul 2015 22:25:39 -0700 |
parents | 5ee62af2a4e3 |
children | aae241804096 |
comparison
equal
deleted
inserted
replaced
478:5ee62af2a4e3 | 479:3b6cbadd0c64 |
---|---|
61 if self.paths is None: | 61 if self.paths is None: |
62 self._values = self._validateAll({}) | 62 self._values = self._validateAll({}) |
63 return | 63 return |
64 | 64 |
65 path_times = [os.path.getmtime(p) for p in self.paths] | 65 path_times = [os.path.getmtime(p) for p in self.paths] |
66 cache_key = hashlib.md5(("version=%s&cache=%d" % ( | 66 cache_key_hash = hashlib.md5(("version=%s&cache=%d" % ( |
67 APP_VERSION, CACHE_VERSION)).encode('utf8')).hexdigest() | 67 APP_VERSION, CACHE_VERSION)).encode('utf8')) |
68 for p in self.paths: | |
69 cache_key_hash.update(("&path=%s" % p).encode('utf8')) | |
70 cache_key = cache_key_hash.hexdigest() | |
68 | 71 |
69 if self.cache.isValid('config.json', path_times): | 72 if self.cache.isValid('config.json', path_times): |
70 logger.debug("Loading configuration from cache...") | 73 logger.debug("Loading configuration from cache...") |
71 config_text = self.cache.read('config.json') | 74 config_text = self.cache.read('config.json') |
72 self._values = json.loads(config_text, | 75 self._values = json.loads(config_text, |