comparison piecrust/data/linker.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 45ad976712ec
children 7e4742a60d14
comparison
equal deleted inserted replaced
988:f83ae0a5d793 989:8adc27285d93
81 ipage = app.getPage(src, i) 81 ipage = app.getPage(src, i)
82 yield PaginationData(ipage) 82 yield PaginationData(ipage)
83 83
84 def forpath(self, path): 84 def forpath(self, path):
85 # TODO: generalize this for sources that aren't file-system based. 85 # TODO: generalize this for sources that aren't file-system based.
86 item = self._source.findContent({'slug': path}) 86 item = self._source.findContentFromSpec({'slug': path})
87 return Linker(self._source, item) 87 return Linker(self._source, item)
88 88
89 def childrenof(self, path): 89 def childrenof(self, path):
90 # TODO: generalize this for sources that aren't file-system based. 90 # TODO: generalize this for sources that aren't file-system based.
91 src = self._source 91 src = self._source
92 app = src.app 92 app = src.app
93 group = src.findGroup(path) 93 group = src.findContentFromSpec(path)
94 if group is not None: 94 if group is not None:
95 if not group.is_group:
96 raise Exception("'%s' is not a folder/group." % path)
95 for i in src.getContents(group): 97 for i in src.getContents(group):
96 if not i.is_group: 98 if not i.is_group:
97 ipage = app.getPage(src, i) 99 ipage = app.getPage(src, i)
98 yield PaginationData(ipage) 100 yield PaginationData(ipage)
99 return None 101 return None