comparison piecrust/pipelines/base.py @ 853:f070a4fc033c

core: Continue PieCrust3 refactor, simplify pages. The asset pipeline is still the only function pipeline at this point. * No more `QualifiedPage`, and several other pieces of code deleted. * Data providers are simpler and more focused. For instance, the page iterator doesn't try to support other types of items. * Route parameters are proper known source metadata to remove the confusion between the two. * Make the baker and pipeline more correctly manage records and record histories. * Add support for record collapsing and deleting stale outputs in the asset pipeline.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 21 May 2017 00:06:59 -0700
parents 4850f8c21b6e
children 08e02c2a2a1a
comparison
equal deleted inserted replaced
852:4850f8c21b6e 853:f070a4fc033c
28 the main process (and not a worker process). This is the case 28 the main process (and not a worker process). This is the case
29 if there are no worker processes at all. 29 if there are no worker processes at all.
30 """ 30 """
31 return self.worker_id < 0 31 return self.worker_id < 0
32 32
33 @property
34 def current_record(self):
35 return self.record_history.current
36
33 37
34 class PipelineResult: 38 class PipelineResult:
35 def __init__(self, record): 39 """ Result of running a pipeline on a content item.
36 self.record = record 40 """
41 def __init__(self):
42 self.pipeline_name = None
43 self.record_entry = None
37 44
38 45
39 class ContentPipeline: 46 class ContentPipeline:
40 """ A pipeline that processes content from a `ContentSource`. 47 """ A pipeline that processes content from a `ContentSource`.
41 """ 48 """
42 PIPELINE_NAME = None 49 PIPELINE_NAME = None
43 PIPELINE_PASSES = 1 50 PIPELINE_PASSES = 1
44 RECORD_CLASS = None 51 RECORD_ENTRY_CLASS = None
45 52
46 def __init__(self, source): 53 def __init__(self, source):
47 self.source = source 54 self.source = source
48 55
49 app = source.app 56 app = source.app
61 pass 68 pass
62 69
63 def run(self, content_item, ctx, result): 70 def run(self, content_item, ctx, result):
64 raise NotImplementedError() 71 raise NotImplementedError()
65 72
73 def getDeletions(self, ctx):
74 pass
75
76 def collapseRecords(self, ctx):
77 pass
78
66 def shutdown(self, ctx): 79 def shutdown(self, ctx):
67 pass 80 pass
68
69 def collapseRecords(self, record_history):
70 pass
71
72 def getDeletions(self, record_history):
73 pass