Mercurial > piecrust2
comparison piecrust/generation/taxonomy.py @ 736:13ec290bfc13
bake: Fix some crashes with new blog archive/taxonomy for incremental bakes.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 01 Jun 2016 22:46:11 -0700 |
parents | 606f6d57b5df |
children | 661f7ba15762 |
comparison
equal
deleted
inserted
replaced
735:6c500fd3194f | 736:13ec290bfc13 |
---|---|
139 level=logging.DEBUG, colored=False): | 139 level=logging.DEBUG, colored=False): |
140 all_terms, dirty_terms = self._buildDirtyTaxonomyTerms(ctx) | 140 all_terms, dirty_terms = self._buildDirtyTaxonomyTerms(ctx) |
141 | 141 |
142 start_time = time.perf_counter() | 142 start_time = time.perf_counter() |
143 page_count = self._bakeTaxonomyTerms(ctx, all_terms, dirty_terms) | 143 page_count = self._bakeTaxonomyTerms(ctx, all_terms, dirty_terms) |
144 logger.info(format_timed( | 144 if page_count > 0: |
145 start_time, | 145 logger.info(format_timed( |
146 "baked %d %s pages." % (page_count, self.taxonomy.term_name))) | 146 start_time, |
147 "baked %d %s pages for %s." % ( | |
148 page_count, self.taxonomy.term_name, self.source_name))) | |
147 | 149 |
148 def _buildDirtyTaxonomyTerms(self, ctx): | 150 def _buildDirtyTaxonomyTerms(self, ctx): |
149 # Build the list of terms for our taxonomy, and figure out which ones | 151 # Build the list of terms for our taxonomy, and figure out which ones |
150 # are 'dirty' for the current bake. | 152 # are 'dirty' for the current bake. |
151 logger.debug("Gathering dirty taxonomy terms") | 153 logger.debug("Gathering dirty taxonomy terms") |
152 all_terms = set() | 154 all_terms = set() |
153 single_dirty_terms = set() | 155 single_dirty_terms = set() |
154 | 156 |
155 # Re-bake all taxonomy terms that include new or changed pages. | 157 # Re-bake all taxonomy terms that include new or changed pages. |
156 for prev_entry, cur_entry in ctx.getBakedPageRecords(): | 158 for prev_entry, cur_entry in ctx.getBakedPageRecords(): |
159 if cur_entry.source_name != self.source_name: | |
160 continue | |
161 | |
157 entries = [cur_entry] | 162 entries = [cur_entry] |
158 if prev_entry: | 163 if prev_entry: |
159 entries.append(prev_entry) | 164 entries.append(prev_entry) |
160 | 165 |
161 terms = [] | 166 terms = [] |