diff piecrust/pipelines/_pagebaker.py @ 877:d6d35b2efd04

bake: Rename "pass" to "step" and make the page pipeline use different steps. That pipeline is now first loading all pages, and then rendering full pages unless they trigger a sub-render.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 15 Jun 2017 22:16:23 -0700
parents 504ddb370df8
children 8419daaa7a0e
line wrap: on
line diff
--- a/piecrust/pipelines/_pagebaker.py	Thu Jun 15 07:33:40 2017 -0700
+++ b/piecrust/pipelines/_pagebaker.py	Thu Jun 15 22:16:23 2017 -0700
@@ -6,6 +6,7 @@
 import urllib.parse
 from piecrust.pipelines._pagerecords import SubPagePipelineRecordEntry
 from piecrust.rendering import RenderingContext, render_page
+from piecrust.sources.base import AbortedSourceUseError
 from piecrust.uriutil import split_uri
 
 
@@ -78,7 +79,6 @@
 
             # Create the sub-entry for the bake record.
             cur_sub_entry = SubPagePipelineRecordEntry(sub_uri, out_path)
-            cur_entry.subs.append(cur_sub_entry)
 
             # Find a corresponding sub-entry in the previous bake record.
             prev_sub_entry = None
@@ -97,6 +97,7 @@
             if bake_status == STATUS_CLEAN:
                 cur_sub_entry.render_info = prev_sub_entry.copyRenderInfo()
                 cur_sub_entry.flags = SubPagePipelineRecordEntry.FLAG_NONE
+                cur_entry.subs.append(cur_sub_entry)
 
                 if prev_entry.num_subs >= cur_sub + 1:
                     cur_sub += 1
@@ -118,6 +119,8 @@
 
                 logger.debug("  p%d -> %s" % (cur_sub, out_path))
                 rp = self._bakeSingle(page, cur_sub, out_path)
+            except AbortedSourceUseError:
+                raise
             except Exception as ex:
                 logger.exception(ex)
                 raise BakingError("%s: error baking '%s'." %
@@ -126,6 +129,7 @@
             # Record what we did.
             cur_sub_entry.flags |= SubPagePipelineRecordEntry.FLAG_BAKED
             cur_sub_entry.render_info = rp.copyRenderInfo()
+            cur_entry.subs.append(cur_sub_entry)
 
             # Copy page assets.
             if (cur_sub == 1 and