diff piecrust/rendering.py @ 1145:e94737572542

serve: Fix an issue where false positive matches were rendered as the requested page. Now we try to render the page, but also try to detect for the most common "empty" pages.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 05 Jun 2018 22:08:51 -0700
parents 1857dbd4580f
children
line wrap: on
line diff
--- a/piecrust/rendering.py	Tue Jun 05 22:05:46 2018 -0700
+++ b/piecrust/rendering.py	Tue Jun 05 22:08:51 2018 -0700
@@ -54,6 +54,7 @@
     return {
         'used_source_names': {'segments': [], 'layout': []},
         'used_pagination': False,
+        'pagination_has_items': False,
         'pagination_has_more': False,
         'used_assets': False,
     }
@@ -95,6 +96,7 @@
             raise Exception("Pagination has already been used.")
         assert paginator.is_loaded
         ri['used_pagination'] = True
+        ri['pagination_has_items'] = paginator.has_items
         ri['pagination_has_more'] = paginator.has_more
         self.addUsedSource(paginator._source)