diff piecrust/rendering.py @ 174:e9a3d405e18f

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.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 03 Jan 2015 21:20:19 -0800
parents 1187739e5a19
children fff195335d0a
line wrap: on
line diff
--- 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(