Mercurial > piecrust2
changeset 110:7f00176a3b4d
Prepare the server to support background asset pipelines.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 16 Oct 2014 08:19:02 -0700 |
parents | 438509f12332 |
children | 208c652551a3 |
files | piecrust/serving.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/serving.py Wed Oct 15 23:02:21 2014 -0700 +++ b/piecrust/serving.py Thu Oct 16 08:19:02 2014 -0700 @@ -26,12 +26,14 @@ class Server(object): def __init__(self, root_dir, host='localhost', port='8080', - debug=False, static_preview=True): + debug=False, static_preview=True, + synchronous_asset_pipeline=True): self.root_dir = root_dir self.host = host self.port = port self.debug = debug self.static_preview = static_preview + self.synchronous_asset_pipeline = synchronous_asset_pipeline self._out_dir = None self._skip_patterns = None self._force_patterns = None @@ -119,11 +121,13 @@ mounts = app.assets_dirs asset_in_path = entry.path asset_out_path = os.path.join(self._out_dir, rel_req_path) - pipeline = ProcessorPipeline( - app, mounts, self._out_dir, - skip_patterns=self._skip_patterns, - force_patterns=self._force_patterns) - pipeline.run(asset_in_path) + + if self.synchronous_asset_pipeline: + pipeline = ProcessorPipeline( + app, mounts, self._out_dir, + skip_patterns=self._skip_patterns, + force_patterns=self._force_patterns) + pipeline.run(asset_in_path) logger.debug("Serving %s" % asset_out_path) wrapper = wrap_file(environ, open(asset_out_path, 'rb'))