diff piecrust/templating/jinja/extensions.py @ 991:1857dbd4580f

bake: Fix bugs introduced by bake optimizations, of course. - Make the execution stats JSON-serializable. - Re-add ability to differentiate between sources used during segment rendering and during layout rendering. Fixes problems with cache invalidation of pages that use other sources. - Make taxonomy-related stuff JSON-serializable.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 20 Nov 2017 23:06:47 -0800
parents 8adc27285d93
children
line wrap: on
line diff
--- a/piecrust/templating/jinja/extensions.py	Sun Nov 19 14:29:52 2017 -0800
+++ b/piecrust/templating/jinja/extensions.py	Mon Nov 20 23:06:47 2017 -0800
@@ -146,19 +146,20 @@
         key = self.environment.piecrust_cache_prefix + name
 
         rcs = self.environment.app.env.render_ctx_stack
-        ri = rcs.current_ctx.render_info
+        ctx = rcs.current_ctx
 
         # try to load the block from the cache
         # if there is no fragment in the cache, render it and store
         # it in the cache.
         pair = self.environment.piecrust_cache.get(key)
         if pair is not None:
-            ri['used_source_names'].update(pair[1])
+            for usn in pair[1]:
+                ctx.addUsedSource(usn)
             return pair[0]
 
-        prev_used = ri['used_source_names'].copy()
+        prev_used = set(ctx.current_used_source_names)
         rv = caller()
-        after_used = ri['used_source_names'].copy()
+        after_used = set(ctx.current_used_source_names)
         used_delta = after_used.difference(prev_used)
         self.environment.piecrust_cache[key] = (rv, used_delta)
         return rv