Mercurial > piecrust2
diff piecrust/templating/jinjaengine.py @ 338:938be93215cb
bake: Improve render context and bake record, fix incremental bake bugs.
* Used sources and taxonomies are now stored on a per-render-pass basis.
This fixes bugs where sources/taxonomies were used for one pass, but that
pass is skipped on a later bake because its result is cached.
* Bake records are now created for all pages even when they're not baked.
Record collapsing is gone except for taxonomy index pages.
* Bake records now also have sub-entries in order to store information about
each sub-page, since some sub-pages could use sources/taxonomies differently
than others, or be missing from the output. This lets PieCrust handle
clean/dirty states on a sub-page level.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 06 Apr 2015 19:59:54 -0700 |
parents | 1ecc0c16ba64 |
children | 498a917cd2d4 |
line wrap: on
line diff
--- a/piecrust/templating/jinjaengine.py Sat Apr 04 07:55:49 2015 -0700 +++ b/piecrust/templating/jinjaengine.py Mon Apr 06 19:59:54 2015 -0700 @@ -386,24 +386,25 @@ exc_stack = self.environment.app.env.exec_info_stack render_ctx = exc_stack.current_page_info.render_ctx + rdr_pass = render_ctx.current_pass_info # 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: - render_ctx.used_source_names.update(pair[1]) + rdr_pass.used_source_names.update(pair[1]) return pair[0] with self._lock: pair = self.environment.piecrust_cache.get(key) if pair is not None: - render_ctx.used_source_names.update(pair[1]) + rdr_pass.used_source_names.update(pair[1]) return pair[0] - prev_used = render_ctx.used_source_names.copy() + prev_used = rdr_pass.used_source_names.copy() rv = caller() - after_used = render_ctx.used_source_names.copy() + after_used = rdr_pass.used_source_names.copy() used_delta = after_used.difference(prev_used) self.environment.piecrust_cache[key] = (rv, used_delta) return rv