# HG changeset patch # User Ludovic Chabant # Date 1507188385 25200 # Node ID 6c445771a8dc4de5f8a832debba9b5da9d6cd370 # Parent a85b2827ba1a0a6d17c1b448492149cb6785cfed internal: Fix caching issues with config variants. Before, changing config variant values could incorrectly re-use a previously cached config as long as there were the same number of variants. Now we build a stricter cache hash based on the actual values. diff -r a85b2827ba1a -r 6c445771a8dc piecrust/appconfig.py --- a/piecrust/appconfig.py Thu Oct 05 00:25:10 2017 -0700 +++ b/piecrust/appconfig.py Thu Oct 05 00:26:25 2017 -0700 @@ -45,6 +45,7 @@ self._path = path self._theme_path = theme_path self._cache = cache or NullCache() + self._cache_hash_mod = '' self._custom_paths = [] self._post_fixups = [] self.theme_config = theme_config @@ -74,6 +75,7 @@ set_dict_value(config, path, value) self._post_fixups.append(_fixup) + self._cache_hash_mod += '&val[%s=%s]' % (path, repr(value)) def setAll(self, values, validate=False): # Override base class implementation @@ -102,8 +104,8 @@ APP_VERSION, CACHE_VERSION)).encode('utf8')) for p in paths: cache_key_hash.update(("&path=%s" % p).encode('utf8')) - cache_key_hash.update( - ("&fixups=%d" % len(self._post_fixups)).encode('utf8')) + if self._cache_hash_mod: + cache_key_hash.update(self._cache_hash_mod.encode('utf8')) cache_key = cache_key_hash.hexdigest() # Check the cache for a valid version.