Mercurial > piecrust2
diff piecrust/serving/server.py @ 515:16e705c58cae
internal: Improve handling of taxonomy term slugification.
This paves the way to bring slugification options like transliteration to
PieCrust. This change mostly makes sure we use one-way slugification, which
means, for serving/previewing, we need to slugify each page's terms to compare
to the stuff captured from the URL. It also simplifies things a bit in the
code.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 26 Jul 2015 23:16:15 -0700 |
parents | 64e1cd71b30b |
children | c7e8b4a5afe3 |
line wrap: on
line diff
--- a/piecrust/serving/server.py Sun Jul 26 23:05:04 2015 -0700 +++ b/piecrust/serving/server.py Sun Jul 26 23:16:15 2015 -0700 @@ -321,11 +321,11 @@ if route_terms is None: return None + tax_terms = route.getTaxonomyTerms(route_metadata) + taxonomy_info = (taxonomy, tax_terms) + tax_page_ref = taxonomy.getPageRef(source) factory = tax_page_ref.getFactory() - tax_terms = route.unslugifyTaxonomyTerm(route_terms) - route_metadata[taxonomy.term_name] = tax_terms - taxonomy_info = (taxonomy, tax_terms) # Build the page. page = factory.buildPage() @@ -336,8 +336,8 @@ page_num=page_num, force_render=True) if taxonomy_info is not None: - taxonomy, tax_terms = taxonomy_info - render_ctx.setTaxonomyFilter(taxonomy, tax_terms) + _, tax_terms = taxonomy_info + render_ctx.setTaxonomyFilter(tax_terms) # See if this page is known to use sources. If that's the case, # just don't use cached rendered segments for that page (but still