Mercurial > piecrust2
comparison piecrust/sources/interfaces.py @ 852:4850f8c21b6e
core: Start of the big refactor for PieCrust 3.0.
* Everything is a `ContentSource`, including assets directories.
* Most content sources are subclasses of the base file-system source.
* A source is processed by a "pipeline", and there are 2 built-in pipelines,
one for assets and one for pages. The asset pipeline is vaguely functional,
but the page pipeline is completely broken right now.
* Rewrite the baking process as just running appropriate pipelines on each
content item. This should allow for better parallelization.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 17 May 2017 00:11:48 -0700 |
parents | 0c74a6c4533d |
children | f070a4fc033c |
comparison
equal
deleted
inserted
replaced
851:2c7e57d80bba | 852:4850f8c21b6e |
---|---|
14 raise NotImplementedError() | 14 raise NotImplementedError() |
15 | 15 |
16 def getTailIterator(self, it): | 16 def getTailIterator(self, it): |
17 raise NotImplementedError() | 17 raise NotImplementedError() |
18 | 18 |
19 def getPaginationFilter(self, page): | |
20 raise NotImplementedError() | |
21 | |
22 def getSettingAccessor(self): | 19 def getSettingAccessor(self): |
23 raise NotImplementedError() | |
24 | |
25 | |
26 class IListableSource(object): | |
27 """ Defines the interface for a source that can be iterated on in a | |
28 hierarchical manner, for use with the `family` data endpoint. | |
29 """ | |
30 def listPath(self, rel_path): | |
31 raise NotImplementedError() | |
32 | |
33 def getDirpath(self, rel_path): | |
34 raise NotImplementedError() | |
35 | |
36 def getBasename(self, rel_path): | |
37 raise NotImplementedError() | 20 raise NotImplementedError() |
38 | 21 |
39 | 22 |
40 class IPreparingSource(object): | 23 class IPreparingSource(object): |
41 """ Defines the interface for a source whose pages can be created by the | 24 """ Defines the interface for a source whose pages can be created by the |
42 `chef prepare` command. | 25 `chef prepare` command. |
43 """ | 26 """ |
44 def setupPrepareParser(self, parser, app): | 27 def setupPrepareParser(self, parser, app): |
45 raise NotImplementedError() | 28 raise NotImplementedError() |
46 | 29 |
47 def buildMetadata(self, args): | 30 def createContent(self, args): |
48 raise NotImplementedError() | 31 raise NotImplementedError() |
49 | 32 |
50 | 33 |
51 class InteractiveField(object): | 34 class InteractiveField(object): |
35 """ A field to display in the administration web UI. | |
36 """ | |
52 TYPE_STRING = 0 | 37 TYPE_STRING = 0 |
53 TYPE_INT = 1 | 38 TYPE_INT = 1 |
54 | 39 |
55 def __init__(self, name, field_type, default_value): | 40 def __init__(self, name, field_type, default_value): |
56 self.name = name | 41 self.name = name |
57 self.field_type = field_type | 42 self.field_type = field_type |
58 self.default_value = default_value | 43 self.default_value = default_value |
59 | 44 |
60 | 45 |
61 class IInteractiveSource(object): | 46 class IInteractiveSource(object): |
47 """ A content source that a user can interact with in the administration | |
48 web UI. | |
49 """ | |
62 def getInteractiveFields(self): | 50 def getInteractiveFields(self): |
63 raise NotImplementedError() | 51 raise NotImplementedError() |
64 | 52 |