Mercurial > piecrust2
comparison piecrust/baking/baker.py @ 324:65e6d72f3877
bake/serve: Fix how taxonomy index pages are setup and rendered.
* Properly use the taxonomy's setting name where appropriate.
* Delete duplicated (and sometimes incorrect) code in 2 places to setup
filtering on an index page and consolidate it on the `PageRenderingContext`.
* Add unit tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 29 Mar 2015 23:08:37 -0700 |
parents | 1f4c3dae1fe8 |
children | 91b07f9efdc1 |
comparison
equal
deleted
inserted
replaced
323:412537e91e45 | 324:65e6d72f3877 |
---|---|
200 changed_terms = None | 200 changed_terms = None |
201 # Re-bake all taxonomy pages that include new or changed | 201 # Re-bake all taxonomy pages that include new or changed |
202 # pages. | 202 # pages. |
203 if (not prev_entry and cur_entry and | 203 if (not prev_entry and cur_entry and |
204 cur_entry.was_baked_successfully): | 204 cur_entry.was_baked_successfully): |
205 changed_terms = cur_entry.config.get(tax.name) | 205 changed_terms = cur_entry.config.get(tax.setting_name) |
206 elif (prev_entry and cur_entry and | 206 elif (prev_entry and cur_entry and |
207 cur_entry.was_baked_successfully): | 207 cur_entry.was_baked_successfully): |
208 changed_terms = [] | 208 changed_terms = [] |
209 prev_terms = prev_entry.config.get(tax.name) | 209 prev_terms = prev_entry.config.get(tax.setting_name) |
210 cur_terms = cur_entry.config.get(tax.name) | 210 cur_terms = cur_entry.config.get(tax.setting_name) |
211 if tax.is_multiple: | 211 if tax.is_multiple: |
212 if prev_terms is not None: | 212 if prev_terms is not None: |
213 changed_terms += prev_terms | 213 changed_terms += prev_terms |
214 if cur_terms is not None: | 214 if cur_terms is not None: |
215 changed_terms += cur_terms | 215 changed_terms += cur_terms |