comparison piecrust/sources/posts.py @ 854:08e02c2a2a1a

core: Keep refactoring, this time to prepare for generator sources. - Make a few APIs simpler. - Content pipelines create their own jobs, so that generator sources can keep aborting in `getContents`, but rely on their pipeline to generate pages for baking.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 04 Jun 2017 23:34:28 -0700
parents f070a4fc033c
children fddaf43424e2
comparison
equal deleted inserted replaced
853:f070a4fc033c 854:08e02c2a2a1a
19 19
20 class PostsSource(FSContentSource, 20 class PostsSource(FSContentSource,
21 SimpleAssetsSubDirMixin, 21 SimpleAssetsSubDirMixin,
22 IPreparingSource, IInteractiveSource): 22 IPreparingSource, IInteractiveSource):
23 PATH_FORMAT = None 23 PATH_FORMAT = None
24 DEFAULT_PIPELINE_NAME = 'page'
24 25
25 def __init__(self, app, name, config): 26 def __init__(self, app, name, config):
26 super().__init__(app, name, config) 27 super().__init__(app, name, config)
27 28
28 config.setdefault('data_type', 'page_iterator') 29 config.setdefault('data_type', 'page_iterator')
120 year = int(m.group('year')) 121 year = int(m.group('year'))
121 month = int(m.group('month')) 122 month = int(m.group('month'))
122 day = int(m.group('day')) 123 day = int(m.group('day'))
123 timestamp = datetime.date(year, month, day) 124 timestamp = datetime.date(year, month, day)
124 metadata = { 125 metadata = {
125 'year': year, 126 'route_params': {
126 'month': month, 127 'year': year,
127 'day': day, 128 'month': month,
128 'slug': m.group('slug'), 129 'day': day,
130 'slug': m.group('slug')
131 },
129 'date': timestamp 132 'date': timestamp
130 } 133 }
131 return metadata 134 return metadata
132 135
133 def getSupportedRouteParameters(self): 136 def getSupportedRouteParameters(self):