changeset 238:4dce0e61b48c

internal: Fix bug with the default source when listing `/` path.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 15 Feb 2015 22:47:46 -0800
parents 879fe1457e48
children f43f19975671
files piecrust/sources/base.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/sources/base.py	Sun Feb 15 22:46:23 2015 -0800
+++ b/piecrust/sources/base.py	Sun Feb 15 22:47:46 2015 -0800
@@ -376,7 +376,8 @@
         return None, None
 
     def listPath(self, rel_path):
-        path = os.path.join(self.fs_endpoint_path, rel_path.lstrip("\\/"))
+        rel_path = rel_path.lstrip('\\/')
+        path = os.path.join(self.fs_endpoint_path, rel_path)
         names = sorted(os.listdir(path))
         items = []
         for name in names:
@@ -396,6 +397,8 @@
 
                     self._populateMetadata(fac_path, metadata)
                     fac = PageFactory(self, fac_path, metadata)
+
+                    name, _ = os.path.splitext(name)
                     items.append((False, name, fac))
         return items