diff piecrust/data/builder.py @ 853:f070a4fc033c

core: Continue PieCrust3 refactor, simplify pages. The asset pipeline is still the only function pipeline at this point. * No more `QualifiedPage`, and several other pieces of code deleted. * Data providers are simpler and more focused. For instance, the page iterator doesn't try to support other types of items. * Route parameters are proper known source metadata to remove the confusion between the two. * Make the baker and pipeline more correctly manage records and record histories. * Add support for record collapsing and deleting stale outputs in the asset pipeline.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 21 May 2017 00:06:59 -0700
parents 4850f8c21b6e
children 08e02c2a2a1a
line wrap: on
line diff
--- a/piecrust/data/builder.py	Wed May 17 00:11:48 2017 -0700
+++ b/piecrust/data/builder.py	Sun May 21 00:06:59 2017 -0700
@@ -1,6 +1,7 @@
 import logging
+from piecrust.data.assetor import Assetor
 from piecrust.data.base import MergedMapping
-from piecrust.data.linker import PageLinkerData
+# from piecrust.data.linker import PageLinkerData
 from piecrust.data.pagedata import PageData
 from piecrust.data.paginator import Paginator
 from piecrust.data.piecrustdata import PieCrustData
@@ -11,32 +12,33 @@
 logger = logging.getLogger(__name__)
 
 
-class DataBuildingContext(object):
-    def __init__(self, qualified_page):
-        self.qualified_page = qualified_page
+class DataBuildingContext:
+    def __init__(self, page, sub_num):
+        self.page = page
+        self.sub_num = sub_num
         self.pagination_source = None
         self.pagination_filter = None
 
 
 def build_page_data(ctx):
-    qpage = ctx.qualified_page
-    page = qpage.page
+    page = ctx.page
+    sub_num = ctx.sub_num
     app = page.app
+
     pgn_source = ctx.pagination_source or get_default_pagination_source(page)
-    first_uri = ctx.page.getUri(1)
 
     pc_data = PieCrustData()
     config_data = PageData(page, ctx)
-    paginator = Paginator(qpage, pgn_source,
+    paginator = Paginator(pgn_source, page, sub_num,
                           pgn_filter=ctx.pagination_filter)
-    assetor = page.source.buildAssetor(page, first_uri)
-    linker = PageLinkerData(page.source, page.rel_path)
+    assetor = Assetor(page)
+    # linker = PageLinkerData(page.source, page.rel_path)
     data = {
         'piecrust': pc_data,
         'page': config_data,
         'assets': assetor,
         'pagination': paginator,
-        'family': linker
+        # 'family': linker
     }
 
     for route in app.routes: