changeset 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 d5885c6d64bd
files piecrust/app.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/app.py	Mon Jul 20 22:22:38 2015 -0700
+++ b/piecrust/app.py	Mon Jul 20 22:25:39 2015 -0700
@@ -63,8 +63,11 @@
             return
 
         path_times = [os.path.getmtime(p) for p in self.paths]
-        cache_key = hashlib.md5(("version=%s&cache=%d" % (
-                APP_VERSION, CACHE_VERSION)).encode('utf8')).hexdigest()
+        cache_key_hash = hashlib.md5(("version=%s&cache=%d" % (
+                APP_VERSION, CACHE_VERSION)).encode('utf8'))
+        for p in self.paths:
+            cache_key_hash.update(("&path=%s" % p).encode('utf8'))
+        cache_key = cache_key_hash.hexdigest()
 
         if self.cache.isValid('config.json', path_times):
             logger.debug("Loading configuration from cache...")