Mercurial > piecrust2
view piecrust/taxonomies.py @ 415:0e9a94b7fdfa
bake: Improve bake record information.
* Store things in the bake record that require less interaction between the
master process and the workers. For instance, don't store the paginator
object in the render pass info -- instead, just store whether pagination
was used, and whether it had more items.
* Simplify information passing between workers and bake passes by saving the
rendering info to the JSON cache. This means the "render first sub" job
doesn't have to return anything except errors now.
* Add more performance counter info.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 20 Jun 2015 19:23:16 -0700 |
parents | e7b865f8f335 |
children |
line wrap: on
line source
from piecrust.sources.pageref import PageRef, PageNotFoundError class Taxonomy(object): def __init__(self, app, name, config): self.app = app self.name = name self.term_name = config.get('term', name) self.is_multiple = config.get('multiple', False) self.page_ref = config.get('page') self._source_page_refs = {} @property def setting_name(self): if self.is_multiple: return self.name return self.term_name def resolvePagePath(self, source): pr = self.getPageRef(source) try: return pr.path except PageNotFoundError: return None def getPageRef(self, source): if source.name in self._source_page_refs: return self._source_page_refs[source.name] ref_path = source.getTaxonomyPageRef(self.name) page_ref = PageRef(self.app, ref_path) self._source_page_refs[source.name] = page_ref return page_ref