comparison piecrust/pipelines/_pagerecords.py @ 871:504ddb370df8

refactor: Fixing some issues with baking assets.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 13 Jun 2017 22:30:27 -0700
parents 08e02c2a2a1a
children 7169bf42ec60
comparison
equal deleted inserted replaced
870:48d25fd68b8d 871:504ddb370df8
48 48
49 def __init__(self): 49 def __init__(self):
50 super().__init__() 50 super().__init__()
51 self.flags = self.FLAG_NONE 51 self.flags = self.FLAG_NONE
52 self.config = None 52 self.config = None
53 self.timestamp = None
53 self.subs = [] 54 self.subs = []
54 55
55 @property 56 @property
56 def was_touched(self): 57 def was_touched(self):
57 return (self.flags & self.FLAG_SOURCE_MODIFIED) != 0 58 return (self.flags & self.FLAG_SOURCE_MODIFIED) != 0
106 for i, sub in enumerate(self.subs): 107 for i, sub in enumerate(self.subs):
107 d['Sub%02d' % i] = { 108 d['Sub%02d' % i] = {
108 'URI': sub.out_uri, 109 'URI': sub.out_uri,
109 'Path': sub.out_path, 110 'Path': sub.out_path,
110 'Flags': get_flag_descriptions( 111 'Flags': get_flag_descriptions(
111 sub.flags, sub_flag_descriptions) 112 sub.flags, sub_flag_descriptions),
113 'RenderInfo': [
114 _describe_render_info(sub.render_info[0]),
115 _describe_render_info(sub.render_info[1])
116 ]
112 } 117 }
113 return d 118 return d
114 119
115 120
116 flag_descriptions = { 121 flag_descriptions = {
127 SubPagePipelineRecordEntry.FLAG_FORCED_BY_PREVIOUS_ERRORS: 132 SubPagePipelineRecordEntry.FLAG_FORCED_BY_PREVIOUS_ERRORS:
128 'forced by errors', 133 'forced by errors',
129 SubPagePipelineRecordEntry.FLAG_FORMATTING_INVALIDATED: 134 SubPagePipelineRecordEntry.FLAG_FORMATTING_INVALIDATED:
130 'formatting invalidated' 135 'formatting invalidated'
131 } 136 }
137
138
139 def _describe_render_info(ri):
140 return {
141 'UsedPagination': ri.used_pagination,
142 'PaginationHasMore': ri.pagination_has_more,
143 'UsedAssets': ri.used_assets,
144 'UsedSourceNames': ri.used_source_names
145 }