Mercurial > piecrust2
diff piecrust/rendering.py @ 520:bab91fcef741
bake/serve: Improve support for unicode, add slugification options.
* Add slugification options for taxonomies.
* Sort out some unicode support problems on OSX.
* Add tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 28 Jul 2015 18:34:21 -0700 |
parents | 16e705c58cae |
children | 094bdf2f7c4c |
line wrap: on
line diff
--- a/piecrust/rendering.py Tue Jul 28 18:29:41 2015 -0700 +++ b/piecrust/rendering.py Tue Jul 28 18:34:21 2015 -0700 @@ -166,15 +166,19 @@ pass_info = self.current_pass_info pass_info.used_source_names.add(source.name) - def setTaxonomyFilter(self, term_value): + def setTaxonomyFilter(self, term_value, *, needs_slugifier=False): if not self.page.route.is_taxonomy_route: raise Exception("The page for this context is not tied to a " "taxonomy route: %s" % self.uri) + slugifier = None + if needs_slugifier: + slugifier = self.page.route.slugifyTaxonomyTerm taxonomy = self.app.getTaxonomy(self.page.route.taxonomy_name) + flt = PaginationFilter(value_accessor=page_value_accessor) flt.addClause(HasTaxonomyTermsFilterClause( - taxonomy, term_value, self.page.route.slugifyTaxonomyTerm)) + taxonomy, term_value, slugifier)) self.pagination_filter = flt is_combination = isinstance(term_value, tuple)