Mercurial > piecrust2
comparison piecrust/pipelines/page.py @ 939:abc52a6262a1
bake: Support the `draft` setting.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 04 Oct 2017 20:40:43 -0700 |
parents | 812ca80863d4 |
children | 45ad976712ec |
comparison
equal
deleted
inserted
replaced
935:7ecb946bfafd | 939:abc52a6262a1 |
---|---|
14 | 14 |
15 def __init__(self, source, ppctx): | 15 def __init__(self, source, ppctx): |
16 super().__init__(source, ppctx) | 16 super().__init__(source, ppctx) |
17 self._pagebaker = None | 17 self._pagebaker = None |
18 self._stats = source.app.env.stats | 18 self._stats = source.app.env.stats |
19 self._draft_setting = self.app.config['baker/no_bake_setting'] | |
19 | 20 |
20 def initialize(self): | 21 def initialize(self): |
21 stats = self.app.env.stats | 22 stats = self.app.env.stats |
22 stats.registerCounter('SourceUseAbortions', raise_if_registered=False) | 23 stats.registerCounter('SourceUseAbortions', raise_if_registered=False) |
23 stats.registerManifest('SourceUseAbortions', raise_if_registered=False) | 24 stats.registerManifest('SourceUseAbortions', raise_if_registered=False) |
112 logger.debug("Loading page: %s" % content_item.spec) | 113 logger.debug("Loading page: %s" % content_item.spec) |
113 page = self.app.getPage(self.source, content_item) | 114 page = self.app.getPage(self.source, content_item) |
114 record_entry = result.record_entry | 115 record_entry = result.record_entry |
115 record_entry.config = page.config.getAll() | 116 record_entry.config = page.config.getAll() |
116 record_entry.timestamp = page.datetime.timestamp() | 117 record_entry.timestamp = page.datetime.timestamp() |
117 result.next_step_job = self.createJob(content_item) | 118 |
119 if not page.config.get(self._draft_setting): | |
120 result.next_step_job = self.createJob(content_item) | |
121 else: | |
122 record_entry.flags |= PagePipelineRecordEntry.FLAG_IS_DRAFT | |
118 | 123 |
119 def _renderOrPostpone(self, content_item, ctx, result): | 124 def _renderOrPostpone(self, content_item, ctx, result): |
120 # Here our job is to render the page's segments so that they're | 125 # Here our job is to render the page's segments so that they're |
121 # cached in memory and on disk... unless we detect that the page | 126 # cached in memory and on disk... unless we detect that the page |
122 # is using some other sources, in which case we abort and we'll try | 127 # is using some other sources, in which case we abort and we'll try |