comparison 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
comparison
equal deleted inserted replaced
1144:9f3e702a8a69 1145:e94737572542
52 saved to records. 52 saved to records.
53 """ 53 """
54 return { 54 return {
55 'used_source_names': {'segments': [], 'layout': []}, 55 'used_source_names': {'segments': [], 'layout': []},
56 'used_pagination': False, 56 'used_pagination': False,
57 'pagination_has_items': False,
57 'pagination_has_more': False, 58 'pagination_has_more': False,
58 'used_assets': False, 59 'used_assets': False,
59 } 60 }
60 61
61 62
93 ri = self.render_info 94 ri = self.render_info
94 if ri.get('used_pagination'): 95 if ri.get('used_pagination'):
95 raise Exception("Pagination has already been used.") 96 raise Exception("Pagination has already been used.")
96 assert paginator.is_loaded 97 assert paginator.is_loaded
97 ri['used_pagination'] = True 98 ri['used_pagination'] = True
99 ri['pagination_has_items'] = paginator.has_items
98 ri['pagination_has_more'] = paginator.has_more 100 ri['pagination_has_more'] = paginator.has_more
99 self.addUsedSource(paginator._source) 101 self.addUsedSource(paginator._source)
100 102
101 def addUsedSource(self, source): 103 def addUsedSource(self, source):
102 usn = self.current_used_source_names 104 usn = self.current_used_source_names