diff piecrust/sources/fs.py @ 862:fddaf43424e2

refactor: Get the page assets to work again in the server.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 08 Jun 2017 23:09:34 -0700
parents 448710d84121
children d9059257743c
line wrap: on
line diff
--- a/piecrust/sources/fs.py	Thu Jun 08 08:52:45 2017 -0700
+++ b/piecrust/sources/fs.py	Thu Jun 08 23:09:34 2017 -0700
@@ -7,7 +7,7 @@
 from piecrust.routing import RouteParameter
 from piecrust.sources.base import (
     ContentItem, ContentGroup, ContentSource,
-    REL_PARENT_GROUP, REL_LOGICAL_PARENT_ITEM, REL_LOGICAl_CHILD_GROUP)
+    REL_LOGICAL_PARENT_ITEM, REL_LOGICAl_CHILD_GROUP)
 
 
 logger = logging.getLogger(__name__)
@@ -110,6 +110,16 @@
         self._finalizeContent(group, items, groups)
         return items + groups
 
+    def getParentGroup(self, item):
+        parent_dir = os.path.dirname(item.spec)
+        if len(parent_dir) >= len(self.fs_endpoint_path):
+            metadata = self._createGroupMetadata(parent_dir)
+            return ContentGroup(parent_dir, metadata)
+
+        # Don't return a group for paths that are outside of our
+        # endpoint directory.
+        return None
+
     def _filterIgnored(self, path):
         rel_path = os.path.relpath(path, self.fs_endpoint_path)
         for g in self._ignore_globs:
@@ -130,16 +140,6 @@
         pass
 
     def getRelatedContents(self, item, relationship):
-        if relationship == REL_PARENT_GROUP:
-            parent_dir = os.path.dirname(item.spec)
-            if len(parent_dir) >= len(self.fs_endpoint_path):
-                metadata = self._createGroupMetadata(parent_dir)
-                return ContentGroup(parent_dir, metadata)
-
-            # Don't return a group for paths that are outside of our
-            # endpoint directory.
-            return None
-
         if relationship == REL_LOGICAL_PARENT_ITEM:
             # If we want the logical parent item of a folder, we find a
             # page file with the same name as the folder.