Mercurial > piecrust2
comparison piecrust/sources/interfaces.py @ 576:0c74a6c4533d
sources: Add code to support "interactive" metadata acquisition.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 19 Dec 2015 18:07:21 -0800 |
parents | f130365568ff |
children | 4850f8c21b6e |
comparison
equal
deleted
inserted
replaced
575:657384f08ca3 | 576:0c74a6c4533d |
---|---|
21 | 21 |
22 def getSettingAccessor(self): | 22 def getSettingAccessor(self): |
23 raise NotImplementedError() | 23 raise NotImplementedError() |
24 | 24 |
25 | 25 |
26 class IListableSource: | 26 class IListableSource(object): |
27 """ Defines the interface for a source that can be iterated on in a | 27 """ Defines the interface for a source that can be iterated on in a |
28 hierarchical manner, for use with the `family` data endpoint. | 28 hierarchical manner, for use with the `family` data endpoint. |
29 """ | 29 """ |
30 def listPath(self, rel_path): | 30 def listPath(self, rel_path): |
31 raise NotImplementedError() | 31 raise NotImplementedError() |
35 | 35 |
36 def getBasename(self, rel_path): | 36 def getBasename(self, rel_path): |
37 raise NotImplementedError() | 37 raise NotImplementedError() |
38 | 38 |
39 | 39 |
40 class IPreparingSource: | 40 class IPreparingSource(object): |
41 """ Defines the interface for a source whose pages can be created by the | 41 """ Defines the interface for a source whose pages can be created by the |
42 `chef prepare` command. | 42 `chef prepare` command. |
43 """ | 43 """ |
44 def setupPrepareParser(self, parser, app): | 44 def setupPrepareParser(self, parser, app): |
45 raise NotImplementedError() | 45 raise NotImplementedError() |
46 | 46 |
47 def buildMetadata(self, args): | 47 def buildMetadata(self, args): |
48 raise NotImplementedError() | 48 raise NotImplementedError() |
49 | 49 |
50 | 50 |
51 class InteractiveField(object): | |
52 TYPE_STRING = 0 | |
53 TYPE_INT = 1 | |
54 | |
55 def __init__(self, name, field_type, default_value): | |
56 self.name = name | |
57 self.field_type = field_type | |
58 self.default_value = default_value | |
59 | |
60 | |
61 class IInteractiveSource(object): | |
62 def getInteractiveFields(self): | |
63 raise NotImplementedError() | |
64 |