Mercurial > piecrust2
diff piecrust/data/assetor.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 | 422052d2e978 |
children | dc78ade3f320 |
line wrap: on
line diff
--- a/piecrust/data/assetor.py Sat Jun 20 19:20:30 2015 -0700 +++ b/piecrust/data/assetor.py Sat Jun 20 19:23:16 2015 -0700 @@ -1,6 +1,7 @@ import os import os.path import logging +from piecrust import ASSET_DIR_SUFFIX from piecrust.uriutil import multi_replace @@ -31,8 +32,6 @@ class Assetor(object): - ASSET_DIR_SUFFIX = '-assets' - debug_render_doc = """Helps render URLs to files in the current page's asset folder.""" debug_render = [] @@ -58,6 +57,10 @@ self._cacheAssets() return map(lambda i: i[0], self._cache.values()) + def _getFilenames(self): + assert self._cache is not None + return map(lambda i: i[1], self._cache.values()) + def _debugRenderAssetNames(self): self._cacheAssets() return list(self._cache.keys()) @@ -68,7 +71,7 @@ self._cache = {} name, ext = os.path.splitext(self._page.path) - assets_dir = name + Assetor.ASSET_DIR_SUFFIX + assets_dir = name + ASSET_DIR_SUFFIX if not os.path.isdir(assets_dir): return @@ -88,6 +91,5 @@ cpi = self._page.app.env.exec_info_stack.current_page_info if cpi is not None: - used_assets = list(map(lambda i: i[1], self._cache.values())) - cpi.render_ctx.used_assets = used_assets + cpi.render_ctx.used_assets = True