changeset 1052:f8572df0756e

serve: Fix crash with autoconfig source pages when serving.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 28 Jan 2018 21:21:32 -0800
parents 971b4d67e82a
children 94d7d5e38571
files piecrust/sources/autoconfig.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/sources/autoconfig.py	Fri Jan 26 18:05:02 2018 -0800
+++ b/piecrust/sources/autoconfig.py	Sun Jan 28 21:21:32 2018 -0800
@@ -103,10 +103,11 @@
             for f in filenames:
                 slug, _ = os.path.splitext(f)
                 if slug == route_slug:
+                    metadata = self._createItemMetadata(path)
                     path = os.path.join(dirpath, f)
                     rel_path = os.path.relpath(path, self.fs_endpoint_path)
                     config = self._extractConfigFragment(rel_path)
-                    metadata = {'slug': slug, 'config': config}
+                    metadata.setdefault('config', {}).update(config)
                     return ContentItem(path, metadata)
         return None
 
@@ -170,9 +171,10 @@
                 if not found:
                     return None
 
+        metadata = self._createItemMetadata(path)
         rel_path = os.path.relpath(path, self.fs_endpoint_path)
         config = self._extractConfigFragment(rel_path)
-        metadata = {'slug': uri_path, 'config': config}
+        metadata.setdefault('config', {}).update(config)
         return ContentItem(path, metadata)
 
     def getSorterIterator(self, it):