# HG changeset patch # User Ludovic Chabant # Date 1420348819 28800 # Node ID e9a3d405e18f032764691ca6944f3d1bf91fc66f # Parent 0a86a7a6b284575c3e80305ee865597a67657a00 serve: Always force render the page being previewed. This is because if the page hasn't changed, but it includes pages that did change, it will re-use the cache and the user will preview the old version. diff -r 0a86a7a6b284 -r e9a3d405e18f piecrust/rendering.py --- a/piecrust/rendering.py Sat Jan 03 21:10:44 2015 -0800 +++ b/piecrust/rendering.py Sat Jan 03 21:20:19 2015 -0800 @@ -39,10 +39,11 @@ class PageRenderingContext(object): - def __init__(self, page, uri, page_num=1): + def __init__(self, page, uri, page_num=1, force_render=False): self.page = page self.uri = uri self.page_num = page_num + self.force_render = force_render self.pagination_source = None self.pagination_filter = None self.custom_data = None @@ -96,7 +97,7 @@ # Render content segments. ctx.current_pass = PASS_FORMATTING repo = ctx.app.env.rendered_segments_repository - if repo: + if repo and not ctx.force_render: cache_key = '%s:%s' % (ctx.uri, ctx.page_num) page_time = page.path_mtime contents = repo.get( diff -r 0a86a7a6b284 -r e9a3d405e18f piecrust/serving.py --- a/piecrust/serving.py Sat Jan 03 21:10:44 2015 -0800 +++ b/piecrust/serving.py Sat Jan 03 21:20:19 2015 -0800 @@ -277,7 +277,10 @@ # Build the page. fac = PageFactory(source, rel_path, fac_metadata) page = fac.buildPage() - render_ctx = PageRenderingContext(page, req_path, page_num) + # We force the rendering of the page because it could not have + # changed, but include pages that did change. + render_ctx = PageRenderingContext(page, req_path, page_num, + force_render=True) if taxonomy is not None: flt = PaginationFilter() if taxonomy.is_multiple: