Mercurial > piecrust2
comparison piecrust/sources/base.py @ 989:8adc27285d93
bake: Big pass on bake performance.
- Reduce the amount of data passed between processes.
- Make inter-process data simple objects to make it easier to test with
alternatives to pickle.
- Make sources have the basic requirement to be able to find a content item
from an item spec (path).
- Make Hoedown the default Markdown formatter.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 19 Nov 2017 14:29:17 -0800 |
parents | ef224cce343c |
children | a6618fdab37e |
comparison
equal
deleted
inserted
replaced
988:f83ae0a5d793 | 989:8adc27285d93 |
---|---|
104 | 104 |
105 def getAllPages(self): | 105 def getAllPages(self): |
106 if self._page_cache is not None: | 106 if self._page_cache is not None: |
107 return self._page_cache | 107 return self._page_cache |
108 | 108 |
109 if self.app.env.abort_source_use: | |
110 raise AbortedSourceUseError() | |
111 | |
112 getter = self.app.getPage | 109 getter = self.app.getPage |
113 self._page_cache = [getter(self, i) for i in self.getAllContents()] | 110 self._page_cache = [getter(self, i) for i in self.getAllContents()] |
114 return self._page_cache | 111 return self._page_cache |
115 | 112 |
116 def getAllContents(self): | 113 def getAllContents(self): |
141 | 138 |
142 def getRelatedContents(self, item, relationship): | 139 def getRelatedContents(self, item, relationship): |
143 raise NotImplementedError( | 140 raise NotImplementedError( |
144 "'%s' doesn't implement 'getRelatedContents'." % self.__class__) | 141 "'%s' doesn't implement 'getRelatedContents'." % self.__class__) |
145 | 142 |
146 def findGroup(self, rel_spec): | 143 def findContentFromSpec(self, spec): |
147 raise NotImplementedError( | 144 raise NotImplementedError( |
148 "'%s' doesn't implement 'findGroup'." % self.__class__) | 145 "'%s' doesn't implement 'findContentFromSpec'." % self.__class__) |
149 | 146 |
150 def findContent(self, route_params): | 147 def findContentFromRoute(self, route_params): |
151 raise NotImplementedError( | 148 raise NotImplementedError( |
152 "'%s' doesn't implement 'findContent'." % self.__class__) | 149 "'%s' doesn't implement 'findContentFromRoute'." % self.__class__) |
153 | 150 |
154 def getSupportedRouteParameters(self): | 151 def getSupportedRouteParameters(self): |
155 raise NotImplementedError( | 152 raise NotImplementedError( |
156 "'%s' doesn't implement 'getSupportedRouteParameters'." % | 153 "'%s' doesn't implement 'getSupportedRouteParameters'." % |
157 self.__class__) | 154 self.__class__) |