Mercurial > piecrust2
comparison piecrust/sources/base.py @ 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 | 016d42c23ba9 |
children | f130365568ff |
comparison
equal
deleted
inserted
replaced
237:879fe1457e48 | 238:4dce0e61b48c |
---|---|
374 return rel_path, metadata | 374 return rel_path, metadata |
375 | 375 |
376 return None, None | 376 return None, None |
377 | 377 |
378 def listPath(self, rel_path): | 378 def listPath(self, rel_path): |
379 path = os.path.join(self.fs_endpoint_path, rel_path.lstrip("\\/")) | 379 rel_path = rel_path.lstrip('\\/') |
380 path = os.path.join(self.fs_endpoint_path, rel_path) | |
380 names = sorted(os.listdir(path)) | 381 names = sorted(os.listdir(path)) |
381 items = [] | 382 items = [] |
382 for name in names: | 383 for name in names: |
383 if os.path.isdir(os.path.join(path, name)): | 384 if os.path.isdir(os.path.join(path, name)): |
384 if self._filterPageDirname(name): | 385 if self._filterPageDirname(name): |
394 fac_path = os.path.join(rel_path, name) | 395 fac_path = os.path.join(rel_path, name) |
395 fac_path = fac_path.replace('\\', '/') | 396 fac_path = fac_path.replace('\\', '/') |
396 | 397 |
397 self._populateMetadata(fac_path, metadata) | 398 self._populateMetadata(fac_path, metadata) |
398 fac = PageFactory(self, fac_path, metadata) | 399 fac = PageFactory(self, fac_path, metadata) |
400 | |
401 name, _ = os.path.splitext(name) | |
399 items.append((False, name, fac)) | 402 items.append((False, name, fac)) |
400 return items | 403 return items |
401 | 404 |
402 def getDirpath(self, rel_path): | 405 def getDirpath(self, rel_path): |
403 return os.path.dirname(rel_path) | 406 return os.path.dirname(rel_path) |