Mercurial > piecrust2
comparison piecrust/baking/single.py @ 586:59268b4d8c71
bake: Add new performance timers.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 10 Jan 2016 10:51:11 -0800 |
parents | 16e705c58cae |
children | 33ab9badfd7a |
comparison
equal
deleted
inserted
replaced
585:25df894f9ab9 | 586:59268b4d8c71 |
---|---|
157 def _bakeSingle(self, qualified_page, num, out_path, tax_info=None): | 157 def _bakeSingle(self, qualified_page, num, out_path, tax_info=None): |
158 ctx = PageRenderingContext(qualified_page, page_num=num) | 158 ctx = PageRenderingContext(qualified_page, page_num=num) |
159 if tax_info: | 159 if tax_info: |
160 ctx.setTaxonomyFilter(tax_info.term) | 160 ctx.setTaxonomyFilter(tax_info.term) |
161 | 161 |
162 rp = render_page(ctx) | 162 with self.app.env.timerScope("PageRender"): |
163 | 163 rp = render_page(ctx) |
164 out_dir = os.path.dirname(out_path) | 164 |
165 _ensure_dir_exists(out_dir) | 165 with self.app.env.timerScope("PageSerialize"): |
166 | 166 out_dir = os.path.dirname(out_path) |
167 with codecs.open(out_path, 'w', 'utf8') as fp: | 167 _ensure_dir_exists(out_dir) |
168 fp.write(rp.content) | 168 |
169 with open(out_path, 'w', encoding='utf8') as fp: | |
170 fp.write(rp.content) | |
169 | 171 |
170 return rp | 172 return rp |
171 | 173 |
172 | 174 |
173 def _compute_force_flags(prev_sub_entry, sub_entry, dirty_source_names): | 175 def _compute_force_flags(prev_sub_entry, sub_entry, dirty_source_names): |