diff piecrust/pipelines/page.py @ 979:45ad976712ec

tests: Big push to get the tests to pass again. - Lots of fixes everywhere in the code. - Try to handle debug logging in the multiprocessing worker pool when running in pytest. Not perfect, but usable for now. - Replace all `.md` test files with `.html` since now a auto-format extension always sets the format. - Replace `out` with `outfiles` in most places since now blog archives are added to the bake output and I don't want to add expected outputs for blog archives everywhere.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 29 Oct 2017 22:51:57 -0700
parents abc52a6262a1
children 8adc27285d93
line wrap: on
line diff
--- a/piecrust/pipelines/page.py	Sun Oct 29 22:46:41 2017 -0700
+++ b/piecrust/pipelines/page.py	Sun Oct 29 22:51:57 2017 -0700
@@ -1,6 +1,6 @@
 import logging
 from piecrust.pipelines.base import ContentPipeline
-from piecrust.pipelines._pagebaker import PageBaker
+from piecrust.pipelines._pagebaker import PageBaker, get_output_path
 from piecrust.pipelines._pagerecords import PagePipelineRecordEntry
 from piecrust.sources.base import AbortedSourceUseError
 
@@ -39,18 +39,21 @@
                         used_paths[p] = (src_name, e)
 
         jobs = []
+        app = self.app
         route = self.source.route
-        pretty_urls = self.app.config.get('site/pretty_urls')
+        out_dir = self.ctx.out_dir
+        pretty_urls = app.config.get('site/pretty_urls')
         record = ctx.record_histories.current.getRecord(self.record_name)
 
         for item in self.source.getAllContents():
             route_params = item.metadata['route_params']
             uri = route.getUri(route_params)
-            path = self._pagebaker.getOutputPath(uri, pretty_urls)
+            path = get_output_path(app, out_dir, uri, pretty_urls)
             override = used_paths.get(path)
+
             if override is not None:
                 override_source_name, override_entry = override
-                override_source = self.app.getSource(override_source_name)
+                override_source = app.getSource(override_source_name)
                 if override_source.config['realm'] == \
                         self.source.config['realm']:
                     logger.error(
@@ -78,9 +81,9 @@
 
     def mergeRecordEntry(self, record_entry, ctx):
         existing = ctx.record.getEntry(record_entry.item_spec)
+        existing.flags |= record_entry.flags
         existing.errors += record_entry.errors
-        existing.flags |= record_entry.flags
-        existing.subs = record_entry.subs
+        existing.subs += record_entry.subs
 
     def run(self, job, ctx, result):
         step_num = job.step_num