Mercurial > piecrust2
comparison piecrust/sources/base.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 | 448710d84121 |
comparison
equal
deleted
inserted
replaced
853:f070a4fc033c | 854:08e02c2a2a1a |
---|---|
11 REALM_USER: 'User', | 11 REALM_USER: 'User', |
12 REALM_THEME: 'Theme'} | 12 REALM_THEME: 'Theme'} |
13 | 13 |
14 | 14 |
15 # Types of relationships a content source can be asked for. | 15 # Types of relationships a content source can be asked for. |
16 REL_ASSETS = 1 | 16 REL_PARENT_GROUP = 1 |
17 REL_LOGICAL_PARENT_ITEM = 2 | |
18 REL_LOGICAl_CHILD_GROUP = 3 | |
19 REL_ASSETS = 10 | |
17 | 20 |
18 | 21 |
19 logger = logging.getLogger(__name__) | 22 logger = logging.getLogger(__name__) |
20 | 23 |
21 | 24 |
41 | 44 |
42 class ContentItem: | 45 class ContentItem: |
43 """ Describes a piece of content. | 46 """ Describes a piece of content. |
44 | 47 |
45 Some known metadata that PieCrust will use include: | 48 Some known metadata that PieCrust will use include: |
46 - `route_params`: A dictionary of route parameters to generate | 49 - `date`: A `datetime.date` object that will set the date of the page. |
47 the URL to the content. | 50 - `datetime`: A `datetime.datetime` object that will set the date and |
48 - `config`: A dictionary of configuration settings to merge | 51 time of the page. |
49 into the settings found in the content itself. | 52 - `route_params`: A dictionary of route parameters to generate the |
53 URL to the content. | |
54 - `config`: A dictionary of configuration settings to merge into the | |
55 settings found in the content itself. | |
50 """ | 56 """ |
51 def __init__(self, spec, metadata): | 57 def __init__(self, spec, metadata): |
52 self.spec = spec | 58 self.spec = spec |
53 self.metadata = metadata | 59 self.metadata = metadata |
54 | 60 |
70 | 76 |
71 | 77 |
72 class ContentSource: | 78 class ContentSource: |
73 """ A source for content. | 79 """ A source for content. |
74 """ | 80 """ |
81 DEFAULT_PIPELINE_NAME = None | |
82 | |
75 def __init__(self, app, name, config): | 83 def __init__(self, app, name, config): |
76 self.app = app | 84 self.app = app |
77 self.name = name | 85 self.name = name |
78 self.config = config or {} | 86 self.config = config or {} |
79 | 87 |