diff 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
line wrap: on
line diff
--- a/piecrust/sources/fs.py	Fri Nov 03 23:14:56 2017 -0700
+++ b/piecrust/sources/fs.py	Sun Nov 19 14:29:17 2017 -0800
@@ -129,11 +129,13 @@
     def _finalizeContent(self, parent_group, items, groups):
         pass
 
-    def findGroup(self, rel_spec):
-        path = os.path.join(self.fs_endpoint_path, rel_spec)
-        if os.path.isdir(path):
-            metadata = self._createGroupMetadata(path)
-            return ContentGroup(path, metadata)
+    def findContentFromSpec(self, spec):
+        if os.path.isdir(spec):
+            metadata = self._createGroupMetadata(spec)
+            return ContentGroup(spec, metadata)
+        elif os.path.isfile(spec):
+            metadata = self._createItemMetadata(spec)
+            return ContentItem(spec, metadata)
         return None
 
     def getRelatedContents(self, item, relationship):