Mercurial > piecrust2
comparison piecrust/routing.py @ 661:2f780b191541
internal: Fix a bug with registering taxonomy terms that are not strings.
Some objects, like the blog data provider's taxnonomy entries, can render as
strings, but are objects themselves. When registering them as "used terms", we
need to use their string representation.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 01 Mar 2016 22:26:09 -0800 |
parents | 6b6c5442c790 |
children | ab5c6a8ae90a |
comparison
equal
deleted
inserted
replaced
660:9f391ab1b4e0 | 661:2f780b191541 |
---|---|
328 if len(args) == 1 and isinstance(args[0], list): | 328 if len(args) == 1 and isinstance(args[0], list): |
329 values = args[0] | 329 values = args[0] |
330 | 330 |
331 # We need to register this use of a taxonomy term. | 331 # We need to register this use of a taxonomy term. |
332 if len(values) == 1: | 332 if len(values) == 1: |
333 registered_values = values[0] | 333 registered_values = str(values[0]) |
334 else: | 334 else: |
335 registered_values = tuple(values) | 335 registered_values = tuple([str(v) for v in values]) |
336 eis = self.app.env.exec_info_stack | 336 eis = self.app.env.exec_info_stack |
337 cpi = eis.current_page_info.render_ctx.current_pass_info | 337 cpi = eis.current_page_info.render_ctx.current_pass_info |
338 if cpi: | 338 if cpi: |
339 cpi.used_taxonomy_terms.add( | 339 cpi.used_taxonomy_terms.add( |
340 (self.source_name, self.taxonomy_name, | 340 (self.source_name, self.taxonomy_name, |