Mercurial > piecrust2
comparison piecrust/sources/fs.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 | 895f49c9833d |
comparison
equal
deleted
inserted
replaced
988:f83ae0a5d793 | 989:8adc27285d93 |
---|---|
127 return {} | 127 return {} |
128 | 128 |
129 def _finalizeContent(self, parent_group, items, groups): | 129 def _finalizeContent(self, parent_group, items, groups): |
130 pass | 130 pass |
131 | 131 |
132 def findGroup(self, rel_spec): | 132 def findContentFromSpec(self, spec): |
133 path = os.path.join(self.fs_endpoint_path, rel_spec) | 133 if os.path.isdir(spec): |
134 if os.path.isdir(path): | 134 metadata = self._createGroupMetadata(spec) |
135 metadata = self._createGroupMetadata(path) | 135 return ContentGroup(spec, metadata) |
136 return ContentGroup(path, metadata) | 136 elif os.path.isfile(spec): |
137 metadata = self._createItemMetadata(spec) | |
138 return ContentItem(spec, metadata) | |
137 return None | 139 return None |
138 | 140 |
139 def getRelatedContents(self, item, relationship): | 141 def getRelatedContents(self, item, relationship): |
140 if relationship == REL_PARENT_GROUP: | 142 if relationship == REL_PARENT_GROUP: |
141 parent_dir = os.path.dirname(item.spec) | 143 parent_dir = os.path.dirname(item.spec) |