diff piecrust/data/paginationdata.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/paginationdata.py	Wed May 17 00:11:48 2017 -0700
+++ b/piecrust/data/paginationdata.py	Sun May 21 00:06:59 2017 -0700
@@ -7,31 +7,30 @@
 
 
 class PaginationData(LazyPageConfigData):
-    def __init__(self, qualified_page):
-        super(PaginationData, self).__init__(qualified_page.page)
-        self._qualified_page = qualified_page
+    def __init__(self, page):
+        super().__init__(page)
 
     def _load(self):
+        from piecrust.data.assetor import Assetor
         from piecrust.uriutil import split_uri
 
         page = self._page
         dt = page.datetime
-        page_url = self._qualified_page.uri
+        page_url = page.getUri()
         _, slug = split_uri(page.app, page_url)
         self._setValue('url', page_url)
         self._setValue('slug', slug)
-        self._setValue(
-            'timestamp',
-            time.mktime(page.datetime.timetuple()))
+        self._setValue('timestamp',
+                       time.mktime(page.datetime.timetuple()))
         self._setValue('datetime', {
             'year': dt.year, 'month': dt.month, 'day': dt.day,
             'hour': dt.hour, 'minute': dt.minute, 'second': dt.second})
         date_format = page.app.config.get('site/date_format')
         if date_format:
             self._setValue('date', page.datetime.strftime(date_format))
-        self._setValue('mtime', page.path_mtime)
+        self._setValue('mtime', page.content_mtime)
 
-        assetor = page.source.buildAssetor(page, page_url)
+        assetor = Assetor(page)
         self._setValue('assets', assetor)
 
         segment_names = page.config.get('segments')
@@ -50,11 +49,11 @@
         assert self is data
 
         if do_render:
-            uri = self._qualified_page.uri
+            uri = self.getUri()
             try:
                 from piecrust.rendering import (
                     RenderingContext, render_page_segments)
-                ctx = RenderingContext(self._qualified_page)
+                ctx = RenderingContext(self._page)
                 render_result = render_page_segments(ctx)
                 segs = render_result.segments
             except Exception as ex: